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

8.0.x
Alex Pott 2013-06-11 10:09:44 +01:00
parent b3b93ac424
commit d3d704e235
3 changed files with 4 additions and 4 deletions

View File

@ -90,7 +90,7 @@ class EntityWrapper extends TypedData implements IteratorAggregate, ComplexDataI
if ($value instanceof EntityInterface && $value->isNew()) {
$this->newEntity = $value;
$this->entityType = $value->entityType();
$value = FALSE;
$value = 0;
}
elseif ($value instanceof EntityInterface) {
$this->entityType = $value->entityType();

View File

@ -30,7 +30,7 @@ abstract class TaxonomyFormatterBase extends FormatterBase {
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => $item) {
// Force the array key to prevent duplicates.
if ($item['tid'] !== FALSE) {
if ($item['tid'] !== 0) {
$tids[$item['tid']] = $item['tid'];
}
}
@ -51,7 +51,7 @@ abstract class TaxonomyFormatterBase extends FormatterBase {
$items[$id][$delta]['entity'] = $terms[$item['tid']];
}
// 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.
}
// Otherwise, unset the instance value, since the term does not exist.

View File

@ -97,7 +97,7 @@ class TaxonomyAutocompleteWidget extends WidgetBase {
'vid' => $vocabulary->id(),
'name' => $value,
));
$item = array('tid' => FALSE, 'entity' => $term);
$item = array('tid' => 0, 'entity' => $term);
}
$items[] = $item;
}