diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index ef33213..e40ccc2 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -605,7 +605,7 @@ public function getAllBundleInfo() { * @return array * An array of entity type labels, keyed by entity type name. */ - public function entityTypeLabels() { + public function getEntityTypeLabels() { $options = array(); foreach ($this->getDefinitions() as $entity_type => $definition) { $options[$entity_type] = $definition['label']; diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php index b27a06a..44483f2 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php @@ -101,7 +101,7 @@ public function settingsForm(array $form, array &$form_state, $has_data) { $element['target_type'] = array( '#type' => 'select', '#title' => t('Type of item to reference'), - '#options' => \Drupal::entityManager()->entityTypeLabels(), + '#options' => \Drupal::entityManager()->getEntityTypeLabels(), '#default_value' => $this->getFieldSetting('target_type'), '#required' => TRUE, '#disabled' => $has_data, diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php index a972ec8..726c0df 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php @@ -46,9 +46,10 @@ public function getPropertyDefinitions() { // Call the parent to define the target_id and entity properties. parent::getPropertyDefinitions(); - // Only add the revision ID property if content entity target types. + // Only add the revision ID property if the target entity type supports + // revisions. $target_type_info = \Drupal::entityManager()->getDefinition($target_type); - if (is_subclass_of($target_type_info['class'], '\Drupal\Core\Entity\ContentEntityInterface')) { + if (!empty($target_type_info['entity_keys']['revision']) && !empty($target_type_info['revision_table'])) { static::$propertyDefinitions[$key]['revision_id'] = array( 'type' => 'integer', 'label' => t('Revision ID'), @@ -93,8 +94,8 @@ public static function schema(FieldInterface $field) { */ public function isEmpty() { // Avoid loading the entity by first checking the 'target_id'. - $target_id = $this->get('target_id')->getValue(); - if (!empty($target_id) && (is_numeric($target_id) || is_string($target_id))) { + $target_id = $this->target_id; + if (!empty($target_id)) { return FALSE; } // Allow auto-create entities.