diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index f384e16..0ab7f93 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -366,7 +366,8 @@ public function buildEntity(array $form, array &$form_state) { $entity->set($key, $value); } - // Invoke all specified builders for copying form values to entity properties. + // Invoke all specified builders for copying form values to entity + // properties. if (isset($form['#entity_builders'])) { foreach ($form['#entity_builders'] as $function) { call_user_func_array($function, array($entity->entityType(), $entity, &$form, &$form_state)); diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index b0974be..e9808d2 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -442,14 +442,15 @@ public function getAdminRouteInfo($entity_type, $bundle) { } /** - * Gets an array of entity field definitions. + * Gets an array of content entity field definitions. * * If a bundle is passed, fields specific to this bundle are included. Entity * fields are always multi-valued, so 'list' is TRUE for each returned field * definition. * * @param string $entity_type - * The entity type to get field definitions for. + * The entity type to get field definitions for. Only entity types that + * implement \Drupal\Core\Entity\ContentEntityInterface are supported. * @param string $bundle * (optional) The entity bundle for which to get field definitions. If NULL * is passed, no bundle-specific fields are included. Defaults to NULL. @@ -477,10 +478,6 @@ public function getFieldDefinitions($entity_type, $bundle = NULL) { } else { $class = $this->factory->getPluginClass($entity_type, $this->getDefinition($entity_type)); - // @todo: This shouldn't be called... - if (!in_array('Drupal\Core\Entity\ContentEntityInterface', class_implements($class))) { - return array(); - } $this->entityFieldInfo[$entity_type] = array( 'definitions' => $class::baseFieldDefinitions($entity_type), // Contains definitions of optional (per-bundle) fields. diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 66567fd..003ec3f 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -8,7 +8,6 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityFormControllerInterface; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Core\TypedData\TranslatableInterface; @@ -269,7 +268,6 @@ function _content_translation_menu_strip_loaders($path) { * The entity whose translation overview should be displayed. */ function content_translation_translate_access(EntityInterface $entity) { - $entity_type = $entity->entityType(); return $entity instanceof ContentEntityInterface && empty($entity->getUntranslated()->language()->locked) && language_multilingual() && $entity->isTranslatable() && (user_access('create content translations') || user_access('update content translations') || user_access('delete content translations')); } @@ -591,7 +589,7 @@ function content_translation_permission() { * Implements hook_form_alter(). */ function content_translation_form_alter(array &$form, array &$form_state) { - if (($form_controller = content_translation_form_controller($form_state)) && ($entity = $form_controller->getEntity()) && !$entity->isNew() && $entity instanceof TranslatableInterface && $entity->isTranslatable()) { + if (($form_controller = content_translation_form_controller($form_state)) && ($entity = $form_controller->getEntity()) && !$entity->isNew() && $entity instanceof ContentEntityInterface && $entity->isTranslatable()) { $controller = content_translation_controller($entity->entityType()); $controller->entityFormAlter($form, $form_state, $entity); @@ -602,7 +600,7 @@ function content_translation_form_alter(array &$form, array &$form_state) { // Handle fields shared between translations when there is at least one // translation available or a new one is being created. - if ($entity instanceof ContentEntityInterface && !$entity->isNew() && (!isset($translations[$form_langcode]) || count($translations) > 1)) { + if (!$entity->isNew() && (!isset($translations[$form_langcode]) || count($translations) > 1)) { foreach ($entity->getPropertyDefinitions() as $property_name => $definition) { if (isset($form[$property_name])) { $form[$property_name]['#multilingual'] = !empty($definition['translatable']); diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index 26d18af..8282d07 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -541,7 +541,7 @@ function _editor_get_file_uuids_by_field(EntityInterface $entity) { * @return array * The names of the fields on this entity that have text processing enabled. */ -function _editor_get_processed_text_fields(EntityInterface $entity) { +function _editor_get_processed_text_fields(ContentEntityInterface $entity) { $properties = $entity->getPropertyDefinitions(); if (empty($properties)) { return array(); diff --git a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php index da813a9..f5febd5 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php +++ b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php @@ -50,8 +50,7 @@ public function isEmpty() { // properties. $item = $this->getValue(TRUE); // The previous hook was never called on an empty item, but - // ContentEntityBase always - // creates a FieldItem element for an empty field. + // ContentEntityBase always creates a FieldItem element for an empty field. return empty($item) || $callback($item, $this->getFieldDefinition()->getFieldType()); } diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php index dbd8065..e95eb01 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php @@ -255,7 +255,8 @@ public function validate(array $form, array &$form_state) { * {@inheritdoc} */ public function buildEntity(array $form, array &$form_state) { - // @todo: Remove this when menu links are content entities. + // @todo: Remove this when menu links are converted to content entities in + // http://drupal.org/node/1842858. $entity = clone $this->entity; // If you submit a form, the form state comes from caching, which forces // the controller to be the one before caching. Ensure to have the diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index c9c9d7a..6644fbb 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -655,7 +655,7 @@ function toolbar_modules_disabled($modules) { * Implements hook_ENTITY_TYPE_update(). */ function toolbar_menu_link_update(MenuLinkInterface $menu_link) { - if ($menu_link->get('menu_name') === 'admin') { + if ($menu_link->menu_name === 'admin') { _toolbar_clear_user_cache(); } }