Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

entries can now be related based on ID. #164

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions services/ImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ public function prepForFieldType(&$data, $handle)
// Convert yes/no values to boolean
switch ($data) {

case Craft::t('Yes');
case Craft::t('Yes'):
$data = true;
break;

case Craft::t('No');
case Craft::t('No'):
$data = false;
break;

Expand Down Expand Up @@ -546,7 +546,7 @@ public function slugify($slug)
*/
protected function _open($file)
{
if(!count($this->_data)) {
if (!count($this->_data)) {

// Turn asset into a file
$asset = craft()->assets->getFileById($file);
Expand Down Expand Up @@ -915,14 +915,20 @@ private function prepEntriesFieldType($data, FieldModel $field)
// Ability to import multiple Assets at once
$data = array();

// Loop through keywords
foreach ($search as $query) {
//if id was given then look for entry id and ignore search param.
if (isset($search[0]) && is_numeric($search[0])) {
$criteria->id = $search[0]; //id passed look by id.
$data = array_merge($data, $criteria->ids());
} else {
// Loop through keywords
foreach ($search as $query) {

// Search
$criteria->search = $query;
// Search
$criteria->search = $query;

// Add to data
$data = array_merge($data, $criteria->ids());
// Add to data
$data = array_merge($data, $criteria->ids());
}
}

return $data;
Expand Down