Commit d3d704e2 authored by alexpott's avatar alexpott
Browse files

Issue #2012662 by yched: Constraints on 'target_id()' / 'tid' properties break...

Issue #2012662 by yched: Constraints on 'target_id()' / 'tid' properties break autocomplete if applied.
parent b3b93ac4
...@@ -90,7 +90,7 @@ public function setValue($value, $notify = TRUE) { ...@@ -90,7 +90,7 @@ public function setValue($value, $notify = TRUE) {
if ($value instanceof EntityInterface && $value->isNew()) { if ($value instanceof EntityInterface && $value->isNew()) {
$this->newEntity = $value; $this->newEntity = $value;
$this->entityType = $value->entityType(); $this->entityType = $value->entityType();
$value = FALSE; $value = 0;
} }
elseif ($value instanceof EntityInterface) { elseif ($value instanceof EntityInterface) {
$this->entityType = $value->entityType(); $this->entityType = $value->entityType();
......
...@@ -30,7 +30,7 @@ public function prepareView(array $entities, $langcode, array &$items) { ...@@ -30,7 +30,7 @@ public function prepareView(array $entities, $langcode, array &$items) {
foreach ($entities as $id => $entity) { foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => $item) { foreach ($items[$id] as $delta => $item) {
// Force the array key to prevent duplicates. // Force the array key to prevent duplicates.
if ($item['tid'] !== FALSE) { if ($item['tid'] !== 0) {
$tids[$item['tid']] = $item['tid']; $tids[$item['tid']] = $item['tid'];
} }
} }
...@@ -51,7 +51,7 @@ public function prepareView(array $entities, $langcode, array &$items) { ...@@ -51,7 +51,7 @@ public function prepareView(array $entities, $langcode, array &$items) {
$items[$id][$delta]['entity'] = $terms[$item['tid']]; $items[$id][$delta]['entity'] = $terms[$item['tid']];
} }
// Terms to be created are not in $terms, but are still legitimate. // Terms to be created are not in $terms, but are still legitimate.
elseif ($item['tid'] === FALSE && isset($item['entity'])) { elseif ($item['tid'] === 0 && isset($item['entity'])) {
// Leave the item in place. // Leave the item in place.
} }
// Otherwise, unset the instance value, since the term does not exist. // Otherwise, unset the instance value, since the term does not exist.
......
...@@ -97,7 +97,7 @@ public function massageFormValues(array $values, array $form, array &$form_state ...@@ -97,7 +97,7 @@ public function massageFormValues(array $values, array $form, array &$form_state
'vid' => $vocabulary->id(), 'vid' => $vocabulary->id(),
'name' => $value, 'name' => $value,
)); ));
$item = array('tid' => FALSE, 'entity' => $term); $item = array('tid' => 0, 'entity' => $term);
} }
$items[] = $item; $items[] = $item;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment