Issue #2012662 by yched: Constraints on 'target_id()' / 'tid' properties break autocomplete if applied.
parent
b3b93ac424
commit
d3d704e235
|
@ -90,7 +90,7 @@ class EntityWrapper extends TypedData implements IteratorAggregate, ComplexDataI
|
||||||
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 @@ abstract class TaxonomyFormatterBase extends FormatterBase {
|
||||||
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 @@ abstract class TaxonomyFormatterBase extends FormatterBase {
|
||||||
$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 @@ class TaxonomyAutocompleteWidget extends WidgetBase {
|
||||||
'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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue