diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php index e4d6a65..a6e0937 100644 --- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php +++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php @@ -219,7 +219,9 @@ public function __isset($name) { */ public function __unset($name) { $value = &$this->__get($name); - $value = array(); + // Unset should act like the property isn't set and thus ignored. Following + // structure will provide that behaviour with EntityBCDecorator::__isset(). + $value = array(LANGUAGE_NOT_SPECIFIED => NULL); } /** diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 29112ef..d815469 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -1086,7 +1086,7 @@ function hook_field_attach_view_alter(&$output, $context) { $element = &$output[$field_name]; if ($element['#field_type'] == 'entity_reference' && $element['#formatter'] == 'entity_reference_label') { foreach ($element['#items'] as $delta => $item) { - $term = $item['taxonomy_term']; + $term = $item['entity']; if (!empty($term->rdf_mapping['rdftype'])) { $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype']; } diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 36bd18a..fa9f24e 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -944,7 +944,10 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options if ($formatter) { $display_langcode = field_language($entity, $field_name, $langcode); - $items = $entity->{$field_name}[$display_langcode]; + $items = array(); + if (isset($entity->{$field_name}[$display_langcode])) { + $items = $entity->{$field_name}[$display_langcode]; + } // Invoke prepare_view steps if needed. if (empty($entity->_field_view_prepared)) { @@ -956,7 +959,10 @@ function field_view_field(EntityInterface $entity, $field_name, $display_options _field_invoke_multiple('prepare_view', $entity->entityType(), array($id => $entity), $null, $null, $options); // Then let the formatter do its own specific massaging. - $items_multi = array($id => $entity->{$field_name}[$display_langcode]); + $items_multi = array($id => array()); + if (isset($entity->{$field_name}[$display_langcode])) { + $items_multi[$id] = $entity->{$field_name}[$display_langcode]; + } $formatter->prepareView(array($id => $entity), $display_langcode, $items_multi); $items = $items_multi[$id]; } diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php index 69374a0..c9e832e 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php @@ -165,7 +165,7 @@ protected function preSaveRevision(\stdClass $record, EntityInterface $entity) { if ($entity->isNewRevision()) { $record->timestamp = REQUEST_TIME; - $record->uid = isset($record->revision_uid) ? $record->revision_uid : $GLOBALS['user']->uid; + $record->uid = isset($entity->revision_uid->value) ? $entity->revision_uid->value : $GLOBALS['user']->uid; } } diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 89494eb..547075a 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -787,9 +787,9 @@ function rdf_field_attach_view_alter(&$output, $context) { foreach ($element['#items'] as $delta => $item) { // This function is invoked during entity preview when taxonomy term // reference items might contain free-tagging terms that do not exist - // yet and thus have no $item['taxonomy_term']. - if (isset($item['taxonomy_term'])) { - $term = $item['taxonomy_term']; + // yet and thus have no $item['entity']. + if (isset($item['entity'])) { + $term = $item['entity']; if (!empty($term->rdf_mapping['rdftype'])) { $element[$delta]['#options']['attributes']['typeof'] = $term->rdf_mapping['rdftype']; } diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 452d5a1..01de5c8 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -1101,7 +1101,7 @@ function taxonomy_field_formatter_view(EntityInterface $entity, $field, $instanc $element = array(); // Terms whose tid is 'autocreate' do not exist - // yet and $item['taxonomy_term'] is not set. Theme such terms as + // yet and $item['entity'] is not set. Theme such terms as // just their name. switch ($display['type']) {