Issue #2031717 by Berdir, swentel, fago: Make entity module not required.

8.0.x
Nathaniel Catchpole 2014-09-02 10:36:57 +01:00
parent 3afec501d4
commit 30cad25c71
76 changed files with 241 additions and 239 deletions

View File

@ -1,6 +1,6 @@
# Schema for Configuration files of the entity module.
entity.view_mode.*.*:
core.entity_view_mode.*.*:
type: mapping
label: 'Entity view mode settings'
mapping:
@ -29,7 +29,7 @@ entity.view_mode.*.*:
type: config_dependencies
label: 'Dependencies'
entity.form_mode.*.*:
core.entity_form_mode.*.*:
type: config_entity
label: 'Entity form mode settings'
mapping:
@ -47,7 +47,7 @@ entity.form_mode.*.*:
label: 'Cache'
# Overview configuration information for view mode or form mode displays.
entity.view_display.*.*.*:
core.entity_view_display.*.*.*:
type: config_entity
label: 'Entity display'
mapping:
@ -79,7 +79,7 @@ entity.view_display.*.*.*:
label: 'Value'
# Overview configuration information for form mode displays.
entity.form_display.*.*.*:
core.entity_form_display.*.*.*:
type: config_entity
label: 'Entity form display'
mapping:

View File

@ -250,7 +250,7 @@ abstract class ConfigEntityBase extends Entity implements ConfigEntityInterface
$id_key = $this->getEntityType()->getKey('id');
foreach (array_keys($definition['mapping']) as $name) {
// Special handling for IDs so that computed compound IDs work.
// @see \Drupal\entity\EntityDisplayBase::id()
// @see \Drupal\Core\Entity\EntityDisplayBase::id()
if ($name == $id_key) {
$properties[$name] = $this->id();
}

View File

@ -7,6 +7,8 @@
namespace Drupal\Core\Config\Entity;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\EntityStorageInterface;
/**
@ -17,6 +19,48 @@ use Drupal\Core\Entity\EntityStorageInterface;
*/
abstract class ConfigEntityBundleBase extends ConfigEntityBase {
/**
* Renames displays when a bundle is renamed.
*/
protected function renameDisplays() {
// Rename entity displays.
if ($this->getOriginalId() !== $this->id()) {
foreach ($this->loadDisplays('entity_view_display') as $display) {
$new_id = $this->getEntityType()->getBundleOf() . '.' . $this->id() . '.' . $display->mode;
$display->set('id', $new_id);
$display->bundle = $this->id();
$display->save();
}
}
// Rename entity form displays.
if ($this->getOriginalId() !== $this->id()) {
foreach ($this->loadDisplays('entity_form_display') as $form_display) {
$new_id = $this->getEntityType()->getBundleOf() . '.' . $this->id() . '.' . $form_display->mode;
$form_display->set('id', $new_id);
$form_display->bundle = $this->id();
$form_display->save();
}
}
}
/**
* Deletes display if a bundle is deleted.
*/
protected function deleteDisplays() {
// Remove entity displays of the deleted bundle.
if ($displays = $this->loadDisplays('entity_view_display')) {
$storage = $this->entityManager()->getStorage('entity_view_display');
$storage->delete($displays);
}
// Remove entity form displays of the deleted bundle.
if ($displays = $this->loadDisplays('entity_form_display')) {
$storage = $this->entityManager()->getStorage('entity_form_display');
$storage->delete($displays);
}
}
/**
* {@inheritdoc}
*/
@ -27,6 +71,7 @@ abstract class ConfigEntityBundleBase extends ConfigEntityBase {
entity_invoke_bundle_hook('create', $this->getEntityType()->getBundleOf(), $this->id());
}
elseif ($this->getOriginalId() != $this->id()) {
$this->renameDisplays();
entity_invoke_bundle_hook('rename', $this->getEntityType()->getBundleOf(), $this->getOriginalId(), $this->id());
}
}
@ -38,8 +83,29 @@ abstract class ConfigEntityBundleBase extends ConfigEntityBase {
parent::postDelete($storage, $entities);
foreach ($entities as $entity) {
$entity->deleteDisplays();
entity_invoke_bundle_hook('delete', $entity->getEntityType()->getBundleOf(), $entity->id());
}
}
/**
* Returns view or form displays for this bundle.
*
* @param string $entity_type_id
* The entity type ID of the display type to load.
*
* @return \Drupal\Core\Entity\Display\EntityDisplayInterface[]
* A list of matching displays.
*/
protected function loadDisplays($entity_type_id) {
$ids = \Drupal::entityQuery($entity_type_id)
->condition('id', $this->getEntityType()->getBundleOf() . '.' . $this->getOriginalId() . '.', 'STARTS_WITH')
->execute();
if ($ids) {
$storage = $this->entityManager()->getStorage($entity_type_id);
return $storage->loadMultiple($ids);
}
return array();
}
}

View File

@ -8,8 +8,8 @@
namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\Entity\EntityFormDisplay;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**

View File

@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\entity\Entity\EntityFormDisplay.
* Contains \Drupal\Core\Entity\Entity\EntityFormDisplay.
*/
namespace Drupal\entity\Entity;
namespace Drupal\Core\Entity\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\EntityDisplayBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\EntityDisplayBase;
/**
* Configuration entity that contains widget options for all components of a
@ -19,7 +19,6 @@ use Drupal\entity\EntityDisplayBase;
* @ConfigEntityType(
* id = "entity_form_display",
* label = @Translation("Entity form display"),
* config_prefix = "form_display",
* entity_keys = {
* "id" = "id",
* "status" = "status"

View File

@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\entity\Entity\EntityFormMode.
* Contains \Drupal\Core\Entity\Entity\EntityFormMode.
*/
namespace Drupal\entity\Entity;
namespace Drupal\Core\Entity\Entity;
use Drupal\entity\EntityDisplayModeBase;
use Drupal\entity\EntityFormModeInterface;
use Drupal\Core\Entity\EntityDisplayModeBase;
use Drupal\Core\Entity\EntityFormModeInterface;
/**
* Defines the form mode configuration entity class.
* Defines the entity form mode configuration entity class.
*
* Form modes allow entity forms to be displayed differently depending on the
* context. For instance, the user entity form can be displayed with a set of
@ -26,27 +26,13 @@ use Drupal\entity\EntityFormModeInterface;
*
* @see \Drupal\Core\Entity\EntityManagerInterface::getAllFormModes()
* @see \Drupal\Core\Entity\EntityManagerInterface::getFormModes()
* @see hook_entity_form_mode_info_alter()
*
* @ConfigEntityType(
* id = "form_mode",
* id = "entity_form_mode",
* label = @Translation("Form mode"),
* handlers = {
* "list_builder" = "Drupal\entity\EntityFormModeListBuilder",
* "form" = {
* "add" = "Drupal\entity\Form\EntityFormModeAddForm",
* "edit" = "Drupal\entity\Form\EntityDisplayModeEditForm",
* "delete" = "Drupal\entity\Form\EntityDisplayModeDeleteForm"
* }
* },
* admin_permission = "administer display modes",
* entity_keys = {
* "id" = "id",
* "label" = "label"
* },
* links = {
* "delete-form" = "entity.form_mode.delete_form",
* "edit-form" = "entity.form_mode.edit_form"
* }
* )
*/

View File

@ -2,15 +2,15 @@
/**
* @file
* Contains \Drupal\entity\Entity\EntityViewDisplay.
* Contains \Drupal\Core\Entity\Entity\EntityViewDisplay.
*/
namespace Drupal\entity\Entity;
namespace Drupal\Core\Entity\Entity;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\entity\EntityDisplayBase;
use Drupal\Core\Entity\EntityDisplayBase;
/**
* Configuration entity that contains display options for all components of a
@ -19,10 +19,6 @@ use Drupal\entity\EntityDisplayBase;
* @ConfigEntityType(
* id = "entity_view_display",
* label = @Translation("Entity view display"),
* handlers = {
* "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage"
* },
* config_prefix = "view_display",
* entity_keys = {
* "id" = "id",
* "status" = "status"

View File

@ -2,16 +2,16 @@
/**
* @file
* Contains \Drupal\entity\Entity\EntityViewMode.
* Contains \Drupal\Core\Entity\Entity\EntityViewMode.
*/
namespace Drupal\entity\Entity;
namespace Drupal\Core\Entity\Entity;
use Drupal\entity\EntityDisplayModeBase;
use Drupal\entity\EntityViewModeInterface;
use Drupal\Core\Entity\EntityDisplayModeBase;
use Drupal\Core\Entity\EntityViewModeInterface;
/**
* Defines the view mode configuration entity class.
* Defines the entity view mode configuration entity class.
*
* View modes let entities be displayed differently depending on the context.
* For instance, a node can be displayed differently on its own page ('full'
@ -30,24 +30,11 @@ use Drupal\entity\EntityViewModeInterface;
* @see hook_entity_view_mode_info_alter()
*
* @ConfigEntityType(
* id = "view_mode",
* id = "entity_view_mode",
* label = @Translation("View mode"),
* handlers = {
* "list_builder" = "Drupal\entity\EntityDisplayModeListBuilder",
* "form" = {
* "add" = "Drupal\entity\Form\EntityDisplayModeAddForm",
* "edit" = "Drupal\entity\Form\EntityDisplayModeEditForm",
* "delete" = "Drupal\entity\Form\EntityDisplayModeDeleteForm"
* }
* },
* admin_permission = "administer display modes",
* entity_keys = {
* "id" = "id",
* "label" = "label"
* },
* links = {
* "delete-form" = "entity.view_mode.delete_form",
* "edit-form" = "entity.view_mode.edit_form"
* }
* )
*/

View File

@ -2,13 +2,12 @@
/**
* @file
* Contains \Drupal\entity\EntityDisplayBase.
* Contains \Drupal\Core\Entity\EntityDisplayBase.
*/
namespace Drupal\entity;
namespace Drupal\Core\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\field\Entity\FieldInstanceConfig;
@ -186,7 +185,7 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
}
// Depend on configured modes.
if ($this->mode != 'default') {
$mode_entity = \Drupal::entityManager()->getStorage($this->displayContext . '_mode')->load($target_entity_type->id() . '.' . $this->mode);
$mode_entity = \Drupal::entityManager()->getStorage('entity_' . $this->displayContext . '_mode')->load($target_entity_type->id() . '.' . $this->mode);
$this->addDependency('entity', $mode_entity->getConfigDependencyName());
}
return $this->dependencies;

View File

@ -2,14 +2,13 @@
/**
* @file
* Contains \Drupal\entity\EntityDisplayModeBase.
* Contains \Drupal\Core\Entity\EntityDisplayModeBase.
*/
namespace Drupal\entity;
namespace Drupal\Core\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
/**
* Base class for config entity types that hold settings for form and view modes.
@ -63,8 +62,8 @@ abstract class EntityDisplayModeBase extends ConfigEntityBase implements EntityD
* {@inheritdoc}
*/
public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
/** @var \Drupal\entity\EntityDisplayModeInterface $a */
/** @var \Drupal\entity\EntityDisplayModeInterface $b */
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $a */
/** @var \Drupal\Core\Entity\EntityDisplayModeInterface $b */
// Sort by the type of entity the view mode is used for.
$a_type = $a->getTargetType();
$b_type = $b->getTargetType();

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\entity\EntityDisplayModeInterface.
* Contains \Drupal\Core\Entity\EntityDisplayModeInterface.
*/
namespace Drupal\entity;
namespace Drupal\Core\Entity;
use Drupal\Core\Config\Entity\ConfigEntityInterface;

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\entity\EntityFormModeInterface.
* Contains \Drupal\Core\Entity\EntityFormModeInterface.
*/
namespace Drupal\entity;
namespace Drupal\Core\Entity;
/**
* Provides an interface defining an entity form mode entity type.

View File

@ -832,13 +832,14 @@ class EntityManager extends DefaultPluginManager implements EntityManagerInterfa
protected function getAllDisplayModesByEntityType($display_type) {
if (!isset($this->displayModeInfo[$display_type])) {
$key = 'entity_' . $display_type . '_info';
$entity_type_id = 'entity_' . $display_type;
$langcode = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_INTERFACE)->id;
if ($cache = $this->cacheBackend->get("$key:$langcode")) {
$this->displayModeInfo[$display_type] = $cache->data;
}
else {
$this->displayModeInfo[$display_type] = array();
foreach ($this->getStorage($display_type)->loadMultiple() as $display_mode) {
foreach ($this->getStorage($entity_type_id)->loadMultiple() as $display_mode) {
list($display_mode_entity_type, $display_mode_name) = explode('.', $display_mode->id(), 2);
$this->displayModeInfo[$display_type][$display_mode_entity_type][$display_mode_name] = $display_mode->toArray();
}

View File

@ -10,14 +10,13 @@ namespace Drupal\Core\Entity;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\Core\Render\Element;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**

View File

@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\entity\EntityViewModeInterface.
* Contains \Drupal\Core\Entity\EntityViewModeInterface.
*/
namespace Drupal\entity;
namespace Drupal\Core\Entity;
/**
* Provides an interface defining an entity view mode entity type.

View File

@ -942,7 +942,19 @@ class ModuleHandler implements ModuleHandlerInterface {
// the module already, which means that it might be loaded, but not
// necessarily installed.
$schema_store = \Drupal::keyValue('system.schema');
$entity_manager = \Drupal::entityManager();
foreach ($module_list as $module) {
// Clean up all entity bundles (including field instances) of every entity
// type provided by the module that is being uninstalled.
foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) {
foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
entity_invoke_bundle_hook('delete', $entity_type_id, $bundle);
}
}
}
// Allow modules to react prior to the uninstallation of a module.
$this->invokeAll('module_preuninstall', array($module));
@ -954,7 +966,7 @@ class ModuleHandler implements ModuleHandlerInterface {
\Drupal::service('config.manager')->uninstall('module', $module);
// Remove any entity schemas belonging to the module.
$entity_manager = \Drupal::entityManager();
$schema = \Drupal::database()->schema();
foreach ($entity_manager->getDefinitions() as $entity_type) {
if ($entity_type->getProvider() == $module) {

View File

@ -24,7 +24,7 @@ class BlockContentCreationTest extends BlockContentTestBase {
*
* @var array
*/
public static $modules = array('block_content_test', 'dblog');
public static $modules = array('block_content_test', 'dblog', 'entity');
/**
* Sets the test up.

View File

@ -20,7 +20,7 @@ use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Render\Element;

View File

@ -14,7 +14,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityViewBuilder;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

View File

@ -7,7 +7,7 @@
namespace Drupal\datetime\Tests;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Datetime\DrupalDateTime;

View File

@ -4,4 +4,3 @@ description: 'Generic entity functionality.'
package: Core
version: VERSION
core: 8.x
required: true

View File

@ -1,13 +1,13 @@
entity.view_mode_add:
route_name: entity.view_mode_add
entity.entity_view_mode_add:
route_name: entity.entity_view_mode_add
title: 'Add new view mode'
weight: 1
appears_on:
- entity.view_mode_list
- entity.entity_view_mode_list
entity.form_mode_add:
route_name: entity.form_mode_add
entity.entity_form_mode_add:
route_name: entity.entity_form_mode_add
title: 'Add new form mode'
weight: 1
appears_on:
- entity.form_mode_list
- entity.entity_form_mode_list

View File

@ -3,13 +3,13 @@ entity.display_mode:
description: 'Configure what displays are available for your content and forms.'
route_name: entity.display_mode
parent: system.admin_structure
entity.view_mode_list:
entity.entity_view_mode_list:
title: 'View modes'
description: 'Manage custom view modes.'
route_name: entity.view_mode_list
route_name: entity.entity_view_mode_list
parent: entity.display_mode
entity.form_mode_list:
entity.entity_form_mode_list:
title: 'Form modes'
description: 'Manage custom form modes.'
route_name: entity.form_mode_list
route_name: entity.entity_form_mode_list
parent: entity.display_mode

View File

@ -1,19 +1,19 @@
entity.view_mode.edit_form:
entity.entity_view_mode.edit_form:
title: 'Edit'
route_name: entity.view_mode.edit_form
base_route: entity.view_mode.edit_form
route_name: entity.entity_view_mode.edit_form
base_route: entity.entity_view_mode.edit_form
entity.form_mode.edit_form:
entity.entity_form_mode.edit_form:
title: 'Edit'
route_name: entity.form_mode.edit_form
base_route: entity.form_mode.edit_form
route_name: entity.entity_form_mode.edit_form
base_route: entity.entity_form_mode.edit_form
entity.view_mode_list:
entity.entity_view_mode_list:
title: List
route_name: entity.view_mode_list
base_route: entity.view_mode_list
route_name: entity.entity_view_mode_list
base_route: entity.entity_view_mode_list
entity.form_mode_list:
entity.entity_form_mode_list:
title: List
route_name: entity.form_mode_list
base_route: entity.form_mode_list
route_name: entity.entity_form_mode_list
base_route: entity.entity_form_mode_list

View File

@ -8,7 +8,6 @@
* entity system.
*/
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\Core\Routing\RouteMatchInterface;
/**
@ -26,9 +25,9 @@ function entity_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Managing view modes') . '</dt>';
$output .= '<dd>' . t('Each content entity can have various "modes" for viewing. For instance, a content item could be viewed in full content mode on its own page, teaser mode in a list, or RSS mode in a feed. You can create, edit the names of, and delete view modes on the <a href="!view-modes">View modes page</a>. Once a view mode has been set up, you can choose and format fields for the view mode within each entity sub-type on the Manage display page. See the <a href="!field_ui">Field UI module help page</a> for more information.', array('!view-modes' => \Drupal::url('entity.view_mode_list'), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
$output .= '<dd>' . t('Each content entity can have various "modes" for viewing. For instance, a content item could be viewed in full content mode on its own page, teaser mode in a list, or RSS mode in a feed. You can create, edit the names of, and delete view modes on the <a href="!view-modes">View modes page</a>. Once a view mode has been set up, you can choose and format fields for the view mode within each entity sub-type on the Manage display page. See the <a href="!field_ui">Field UI module help page</a> for more information.', array('!view-modes' => \Drupal::url('entity.entity_view_mode_list'), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
$output .= '<dt>' . t('Managing form modes') . '</dt>';
$output .= '<dd>' . t('Each content entity can have various editing forms appropriate for different situations, which are known as "form modes". For instance, you might want to define a quick editing mode that allows users to edit the most important fields, and a full editing mode that gives access to all the fields. You can create, edit the names of, and delete form modes on the <a href="!form-modes">Manage custom form modes page</a>. Once a form mode has been set up, you can choose which fields are available on that form within each entity sub-type on the Manage form display page. See the <a href="!field_ui">Field UI module help page</a> for more information.', array('!form-modes' => \Drupal::url('entity.form_mode_list'), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
$output .= '<dd>' . t('Each content entity can have various editing forms appropriate for different situations, which are known as "form modes". For instance, you might want to define a quick editing mode that allows users to edit the most important fields, and a full editing mode that gives access to all the fields. You can create, edit the names of, and delete form modes on the <a href="!form-modes">Manage custom form modes page</a>. Once a form mode has been set up, you can choose which fields are available on that form within each entity sub-type on the Manage form display page. See the <a href="!field_ui">Field UI module help page</a> for more information.', array('!form-modes' => \Drupal::url('entity.entity_form_mode_list'), '!field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
$output .= '</dl>';
return $output;
}
@ -46,70 +45,26 @@ function entity_permission() {
}
/**
* Implements hook_entity_bundle_rename().
* Implements hook_entity_type_alter().
*/
function entity_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_new) {
// Rename entity displays.
$entity_type = \Drupal::entityManager()->getDefinition('entity_view_display');
if ($bundle_old !== $bundle_new) {
$ids = \Drupal::configFactory()->listAll('entity.view_display.' . $entity_type_id . '.' . $bundle_old . '.');
foreach ($ids as $id) {
$id = ConfigEntityStorage::getIDFromConfigName($id, $entity_type->getConfigPrefix());
$display = entity_load('entity_view_display', $id);
$new_id = $entity_type_id . '.' . $bundle_new . '.' . $display->mode;
$display->set('id', $new_id);
$display->bundle = $bundle_new;
$display->save();
}
}
function entity_entity_type_alter(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$form_mode = $entity_types['entity_form_mode'];
$form_mode->setListBuilderClass('Drupal\entity\EntityFormModeListBuilder');
$form_mode->setFormClass('add', 'Drupal\entity\Form\EntityFormModeAddForm');
$form_mode->setFormClass('edit', 'Drupal\entity\Form\EntityDisplayModeEditForm');
$form_mode->setFormClass('delete', 'Drupal\entity\Form\EntityDisplayModeDeleteForm');
$form_mode->set('admin_permission', 'administer display modes');
$form_mode->setLinkTemplate('delete-form', 'entity.entity_form_mode.delete_form');
$form_mode->setLinkTemplate('edit-form', 'entity.entity_form_mode.edit_form');
// Rename entity form displays.
$entity_type = \Drupal::entityManager()->getDefinition('entity_form_display');
if ($bundle_old !== $bundle_new) {
$ids = \Drupal::configFactory()->listAll('entity.form_display.' . $entity_type_id . '.' . $bundle_old . '.');
foreach ($ids as $id) {
$id = ConfigEntityStorage::getIDFromConfigName($id, $entity_type->getConfigPrefix());
$form_display = entity_load('entity_form_display', $id);
$new_id = $entity_type_id . '.' . $bundle_new . '.' . $form_display->mode;
$form_display->set('id', $new_id);
$form_display->bundle = $bundle_new;
$form_display->save();
}
}
$view_mode = $entity_types['entity_view_mode'];
$view_mode->setListBuilderClass('Drupal\entity\EntityDisplayModeListBuilder');
$view_mode->setFormClass('add', 'Drupal\entity\Form\EntityDisplayModeAddForm');
$view_mode->setFormClass('edit', 'Drupal\entity\Form\EntityDisplayModeEditForm');
$view_mode->setFormClass('delete', 'Drupal\entity\Form\EntityDisplayModeDeleteForm');
$view_mode->set('admin_permission', 'administer display modes');
$view_mode->setLinkTemplate('delete-form', 'entity.entity_view_mode.delete_form');
$view_mode->setLinkTemplate('edit-form', 'entity.entity_view_mode.edit_form');
}
/**
* Implements hook_entity_bundle_delete().
*/
function entity_entity_bundle_delete($entity_type_id, $bundle) {
// Remove entity displays of the deleted bundle.
$entity_type = \Drupal::entityManager()->getDefinition('entity_view_display');
$ids = \Drupal::configFactory()->listAll('entity.view_display.' . $entity_type_id . '.' . $bundle . '.');
foreach ($ids as &$id) {
$id = ConfigEntityStorage::getIDFromConfigName($id, $entity_type->getConfigPrefix());
}
entity_delete_multiple('entity_view_display', $ids);
// Remove entity form displays of the deleted bundle.
$entity_type = \Drupal::entityManager()->getDefinition('entity_form_display');
$ids = \Drupal::configFactory()->listAll('entity.form_display.' . $entity_type_id . '.' . $bundle . '.');
foreach ($ids as &$id) {
$id = ConfigEntityStorage::getIDFromConfigName($id, $entity_type->getConfigPrefix());
}
entity_delete_multiple('entity_form_display', $ids);
}
/**
* Implements hook_module_preuninstall().
*/
function entity_module_preuninstall($module) {
// Clean up all entity bundles (including field instances) of every entity
// type provided by the module that is being uninstalled.
foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->getProvider() == $module) {
foreach (array_keys(entity_get_bundles($entity_type_id)) as $bundle) {
entity_invoke_bundle_hook('delete', $entity_type_id, $bundle);
}
}
}
}

View File

@ -6,15 +6,15 @@ entity.display_mode:
requirements:
_permission: 'administer display modes'
entity.view_mode_list:
entity.entity_view_mode_list:
path: '/admin/structure/display-modes/view'
defaults:
_entity_list: 'view_mode'
_entity_list: 'entity_view_mode'
_title: 'View modes'
requirements:
_permission: 'administer display modes'
entity.view_mode_add:
entity.entity_view_mode_add:
path: '/admin/structure/display-modes/view/add'
defaults:
_content: '\Drupal\entity\Controller\EntityDisplayModeController::viewModeTypeSelection'
@ -22,39 +22,39 @@ entity.view_mode_add:
requirements:
_permission: 'administer display modes'
entity.view_mode_add_type:
entity.entity_view_mode_add_type:
path: '/admin/structure/display-modes/view/add/{entity_type_id}'
defaults:
_entity_form: 'view_mode.add'
_entity_form: 'entity_view_mode.add'
_title: 'Add view mode'
requirements:
_permission: 'administer display modes'
entity.view_mode.edit_form:
path: '/admin/structure/display-modes/view/manage/{view_mode}'
entity.entity_view_mode.edit_form:
path: '/admin/structure/display-modes/view/manage/{entity_view_mode}'
defaults:
_entity_form: 'view_mode.edit'
_entity_form: 'entity_view_mode.edit'
_title: 'Edit view mode'
requirements:
_entity_access: 'view_mode.update'
_entity_access: 'entity_view_mode.update'
entity.view_mode.delete_form:
path: '/admin/structure/display-modes/view/manage/{view_mode}/delete'
entity.entity_view_mode.delete_form:
path: '/admin/structure/display-modes/view/manage/{entity_view_mode}/delete'
defaults:
_entity_form: 'view_mode.delete'
_entity_form: 'entity_view_mode.delete'
_title: 'Delete view mode'
requirements:
_entity_access: 'view_mode.delete'
_entity_access: 'entity_view_mode.delete'
entity.form_mode_list:
entity.entity_form_mode_list:
path: '/admin/structure/display-modes/form'
defaults:
_entity_list: 'form_mode'
_entity_list: 'entity_form_mode'
_title: 'Form modes'
requirements:
_permission: 'administer display modes'
entity.form_mode_add:
entity.entity_form_mode_add:
path: '/admin/structure/display-modes/form/add'
defaults:
_content: '\Drupal\entity\Controller\EntityDisplayModeController::formModeTypeSelection'
@ -62,26 +62,26 @@ entity.form_mode_add:
requirements:
_permission: 'administer display modes'
entity.form_mode_add_type:
entity.entity_form_mode_add_type:
path: '/admin/structure/display-modes/form/add/{entity_type_id}'
defaults:
_entity_form: 'form_mode.add'
_entity_form: 'entity_form_mode.add'
_title: 'Add form mode'
requirements:
_permission: 'administer display modes'
entity.form_mode.edit_form:
path: '/admin/structure/display-modes/form/manage/{form_mode}'
entity.entity_form_mode.edit_form:
path: '/admin/structure/display-modes/form/manage/{entity_form_mode}'
defaults:
_entity_form: 'form_mode.edit'
_entity_form: 'entity_form_mode.edit'
_title: 'Edit form mode'
requirements:
_entity_access: 'form_mode.update'
_entity_access: 'entity_form_mode.update'
entity.form_mode.delete_form:
path: '/admin/structure/display-modes/form/manage/{form_mode}/delete'
entity.entity_form_mode.delete_form:
path: '/admin/structure/display-modes/form/manage/{entity_form_mode}/delete'
defaults:
_entity_form: 'form_mode.delete'
_entity_form: 'entity_form_mode.delete'
_title: 'Delete form mode'
requirements:
_entity_access: 'form_mode.delete'
_entity_access: 'entity_form_mode.delete'

View File

@ -27,7 +27,7 @@ class EntityDisplayModeController extends ControllerBase {
if ($entity_type->isFieldable() && $entity_type->hasViewBuilderClass()) {
$entity_types[$entity_type_id] = array(
'title' => $entity_type->getLabel(),
'url' => new Url('entity.view_mode_add_type', array('entity_type_id' => $entity_type_id)),
'url' => new Url('entity.entity_view_mode_add_type', array('entity_type_id' => $entity_type_id)),
'localized_options' => array(),
);
}
@ -50,7 +50,7 @@ class EntityDisplayModeController extends ControllerBase {
if ($entity_type->isFieldable() && $entity_type->hasFormClasses()) {
$entity_types[$entity_type_id] = array(
'title' => $entity_type->getLabel(),
'url' => new Url('entity.form_mode_add_type', array('entity_type_id' => $entity_type_id)),
'url' => new Url('entity.entity_form_mode_add_type', array('entity_type_id' => $entity_type_id)),
'localized_options' => array(),
);
}

View File

@ -21,7 +21,7 @@ class EntityDisplayModeTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('entity_test');
public static $modules = array('entity_test', 'entity');
/**
* Tests the EntityViewMode user interface.

View File

@ -7,6 +7,7 @@
namespace Drupal\entity\Tests;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\simpletest\DrupalUnitTestBase;
/**
@ -78,12 +79,12 @@ class EntityDisplayTest extends DrupalUnitTestBase {
// Check that CreateCopy() creates a new component that can be correclty
// saved.
entity_create('view_mode', array('id' => $display->targetEntityType . '.other_view_mode', 'targetEntityType' => $display->targetEntityType))->save();
EntityViewMode::create(array('id' => $display->targetEntityType . '.other_view_mode', 'targetEntityType' => $display->targetEntityType))->save();
$new_display = $display->createCopy('other_view_mode');
$new_display->save();
$new_display = entity_load('entity_view_display', $new_display->id());
$dependencies = $new_display->calculateDependencies();
$this->assertEqual(array('entity' => array('entity.view_mode.entity_test.other_view_mode'), 'module' => array('entity_test')), $dependencies);
$this->assertEqual(array('entity' => array('core.entity_view_mode.entity_test.other_view_mode'), 'module' => array('entity_test')), $dependencies);
$this->assertEqual($new_display->targetEntityType, $display->targetEntityType);
$this->assertEqual($new_display->bundle, $display->bundle);
$this->assertEqual($new_display->mode, 'other_view_mode');
@ -233,7 +234,7 @@ class EntityDisplayTest extends DrupalUnitTestBase {
// Check that saving the display only writes data for fields whose display
// is configurable.
$display->save();
$config = \Drupal::config('entity.view_display.' . $display->id());
$config = \Drupal::config('core.entity_view_display.' . $display->id());
$data = $config->get();
$this->assertFalse(isset($data['content']['test_no_display']));
$this->assertFalse(isset($data['hidden']['test_no_display']));
@ -275,9 +276,9 @@ class EntityDisplayTest extends DrupalUnitTestBase {
$type->type = 'article_rename';
$type->save();
$old_display = entity_load('entity_view_display', 'node.article.default');
$this->assertFalse($old_display);
$this->assertFalse((bool) $old_display);
$old_form_display = entity_load('entity_form_display', 'node.article.default');
$this->assertFalse($old_form_display);
$this->assertFalse((bool) $old_form_display);
$new_display = entity_load('entity_view_display', 'node.article_rename.default');
$this->assertEqual('article_rename', $new_display->bundle);
$this->assertEqual('node.article_rename.default', $new_display->id);
@ -302,9 +303,9 @@ class EntityDisplayTest extends DrupalUnitTestBase {
// Delete the bundle.
$type->delete();
$display = entity_load('entity_view_display', 'node.article_rename.default');
$this->assertFalse($display);
$this->assertFalse((bool) $display);
$form_display = entity_load('entity_form_display', 'node.article_rename.default');
$this->assertFalse($form_display);
$this->assertFalse((bool) $form_display);
}
/**
@ -326,7 +327,7 @@ class EntityDisplayTest extends DrupalUnitTestBase {
$instance->save();
// Create default and teaser entity display.
entity_create('view_mode', array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
entity_create('entity_view_display', array(
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',

View File

@ -7,6 +7,7 @@
namespace Drupal\entity\Tests;
use Drupal\Core\Entity\Entity\EntityFormMode;
use Drupal\simpletest\DrupalUnitTestBase;
/**
@ -146,7 +147,7 @@ class EntityFormDisplayTest extends DrupalUnitTestBase {
// Check that saving the display only writes data for fields whose display
// is configurable.
$display->save();
$config = \Drupal::config('entity.form_display.' . $display->id());
$config = \Drupal::config('core.entity_form_display.' . $display->id());
$data = $config->get();
$this->assertFalse(isset($data['content']['test_no_display']));
$this->assertFalse(isset($data['hidden']['test_no_display']));
@ -190,7 +191,7 @@ class EntityFormDisplayTest extends DrupalUnitTestBase {
$instance->save();
// Create default and compact entity display.
entity_create('form_mode', array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
EntityFormMode::create(array('id' => 'entity_test.compact', 'targetEntityType' => 'entity_test'))->save();
entity_create('entity_form_display', array(
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',

View File

@ -119,7 +119,7 @@ function hook_field_storage_config_update_forbid(\Drupal\field\FieldStorageConfi
* Widgets are @link forms_api_reference.html Form API @endlink
* elements with additional processing capabilities. The methods of the
* WidgetInterface object are typically called by respective methods in the
* \Drupal\entity\Entity\EntityFormDisplay class.
* \Drupal\Core\Entity\Entity\EntityFormDisplay class.
*
* @see field
* @see field_types

View File

@ -7,6 +7,8 @@
namespace Drupal\field\Tests;
use Drupal\Core\Entity\Entity\EntityViewMode;
/**
* Tests the field display API.
*
@ -99,7 +101,7 @@ class DisplayApiTest extends FieldUnitTestBase {
->setComponent($this->field_name, $this->display_options['default'])
->save();
// Create a display for the teaser view mode.
entity_create('view_mode', array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
EntityViewMode::create(array('id' => 'entity_test.teaser', 'targetEntityType' => 'entity_test'))->save();
entity_get_display($instance['entity_type'], $instance['bundle'], 'teaser')
->setComponent($this->field_name, $this->display_options['teaser'])
->save();

View File

@ -10,7 +10,7 @@ namespace Drupal\field_test\Form;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
/**
* Provides a form for field_test routes.

View File

@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\entity\EntityViewModeInterface;
use Drupal\Core\Entity\EntityViewModeInterface;
use Drupal\field_ui\FieldUI;
use Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask;

View File

@ -9,7 +9,7 @@ namespace Drupal\migrate\Plugin\migrate\destination;
/**
* @MigrateDestination(
* id = "entity:view_mode"
* id = "entity:entity_view_mode"
* )
*/
class EntityViewMode extends EntityConfigBase {

View File

@ -33,7 +33,7 @@ class PerComponentEntityDisplayTest extends MigrateTestCase {
foreach ($values as $key => $value) {
$row->setDestinationProperty($key, $value);
}
$entity = $this->getMockBuilder('Drupal\entity\Entity\EntityViewDisplay')
$entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityViewDisplay')
->disableOriginalConstructor()
->getMock();
$entity->expects($this->once())

View File

@ -33,7 +33,7 @@ class PerComponentEntityFormDisplayTest extends MigrateTestCase {
foreach ($values as $key => $value) {
$row->setDestinationProperty($key, $value);
}
$entity = $this->getMockBuilder('Drupal\entity\Entity\EntityFormDisplay')
$entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityFormDisplay')
->disableOriginalConstructor()
->getMock();
$entity->expects($this->once())

View File

@ -37,4 +37,4 @@ process:
status: 'constants/status'
destination:
plugin: entity:view_mode
plugin: entity:entity_view_mode

View File

@ -11,7 +11,7 @@ use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
/**
* Upgrade comment subject variable to entity.form_display.comment.*.default.yml
* Upgrade comment subject variable to core.entity_form_display.comment.*.default.yml
*
* @group migrate_drupal
*/

View File

@ -8,7 +8,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
/**
* Upgrade comment variables to entity.form_display.node.*.default.yml.
* Upgrade comment variables to core.entity_form_display.node.*.default.yml.
*
* @group migrate_drupal
*/

View File

@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
@ -33,7 +34,7 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupalTestBase {
entity_create('node_type', array('type' => 'test_page'))->save();
entity_create('node_type', array('type' => 'story'))->save();
// Create the node preview view mode.
entity_create('view_mode', array('id' => 'node.preview', 'targetEntityType' => 'node'))->save();
EntityViewMode::create(array('id' => 'node.preview', 'targetEntityType' => 'node'))->save();
// Add some id mappings for the dependant migrations.
$id_mappings = array(

View File

@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Tests\d6;
use Drupal\Core\Entity\Entity\EntityViewMode;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
@ -43,7 +44,7 @@ class MigrateViewModesTest extends MigrateDrupalTestBase {
*/
public function testViewModes() {
// Test a new view mode.
$view_mode = entity_load('view_mode', 'node.preview');
$view_mode = EntityViewMode::load('node.preview');
$this->assertEqual(is_null($view_mode), FALSE, 'Preview view mode loaded.');
$this->assertEqual($view_mode->label(), 'Preview', 'View mode has correct label.');
// Test the Id Map.

View File

@ -13,7 +13,6 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@ -141,9 +140,9 @@ class NodePreviewForm extends FormBase implements ContainerInjectionInterface {
$view_modes = $this->entityManager->getViewModes('node');
// Get the list of available view modes for the current node's bundle.
$ids = $this->configFactory->listAll('entity.view_display.node.' . $node->bundle());
$ids = $this->configFactory->listAll('core.entity_view_display.node.' . $node->bundle());
foreach ($ids as $id) {
$config_id = str_replace('entity.view_display' . '.', '', $id);
$config_id = str_replace('core.entity_view_display' . '.', '', $id);
$load_ids[] = $config_id;
}
$displays = entity_load_multiple('entity_view_display', $load_ids);

View File

@ -86,9 +86,9 @@ class NodeTypeRenameConfigImportTest extends WebTestBase {
$expected = array(
'node.type.' . $active_type . '::node.type.' . $staged_type,
'core.base_field_override.node.' . $active_type . '.status::core.base_field_override.node.' . $staged_type . '.status',
'entity.form_display.node.' . $active_type . '.default::entity.form_display.node.' . $staged_type . '.default',
'entity.view_display.node.' . $active_type . '.default::entity.view_display.node.' . $staged_type . '.default',
'entity.view_display.node.' . $active_type . '.teaser::entity.view_display.node.' . $staged_type . '.teaser',
'core.entity_form_display.node.' . $active_type . '.default::core.entity_form_display.node.' . $staged_type . '.default',
'core.entity_view_display.node.' . $active_type . '.default::core.entity_view_display.node.' . $staged_type . '.default',
'core.entity_view_display.node.' . $active_type . '.teaser::core.entity_view_display.node.' . $staged_type . '.teaser',
'field.instance.node.' . $active_type . '.body::field.instance.node.' . $staged_type . '.body',
);
$renames = $this->configImporter()->getUnprocessedConfiguration('rename');

View File

@ -15,7 +15,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\user\TempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;

View File

@ -12,7 +12,7 @@ use Drupal\Component\Utility\String;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface;
use Drupal\entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
/**
* Generates in-place editing metadata for an entity field.

View File

@ -147,7 +147,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
*/
protected function selectViewMode($entity_type) {
$view_modes = \Drupal::entityManager()
->getStorage('view_mode')
->getStorage('entity_view_mode')
->loadByProperties(array('targetEntityType' => $entity_type));
if (empty($view_modes)) {

View File

@ -12,7 +12,7 @@ use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
/**
* Filter that limits test entity list to revisable ones.

View File

@ -6,5 +6,3 @@ version: VERSION
core: 8.x
required: true
configure: user.admin_index
dependencies:
- entity

View File

@ -96,9 +96,9 @@ class AreaEntityTest extends ViewTestBase {
$this->assertTrue(strpos(trim((string) $result[0]), 'full') !== FALSE, 'The rendered entity appeared in the right view mode.');
// Mark entity_test test view_mode as customizable.
$view_mode = \Drupal::entityManager()->getStorage('view_mode')->load('entity_test.test');
$view_mode->enable();
$view_mode->save();
$entity_view_mode = \Drupal::entityManager()->getStorage('entity_view_mode')->load('entity_test.test');
$entity_view_mode->enable();
$entity_view_mode->save();
// Change the view mode of the area handler.
$view = Views::getView('test_entity_area');

View File

@ -27,7 +27,7 @@ content:
label: above
dependencies:
entity:
- entity.view_mode.node.teaser
- core.entity_view_mode.node.teaser
- field.instance.node.article.body
- field.instance.node.article.field_image
- field.instance.node.article.field_tags

View File

@ -16,7 +16,7 @@ hidden:
status: true
dependencies:
entity:
- entity.view_mode.user.compact
- core.entity_view_mode.user.compact
module:
- image
- user

View File

@ -19,6 +19,7 @@ dependencies:
- block_content
- quickedit
- editor
- entity
- entity_reference
- help
- image

View File

@ -11,7 +11,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\entity\EntityDisplayModeBase
* @coversDefaultClass \Drupal\Core\Entity\EntityDisplayModeBase
* @group Config
*/
class EntityDisplayModeBaseUnitTest extends UnitTestCase {
@ -19,7 +19,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase {
/**
* The entity under test.
*
* @var \Drupal\entity\EntityDisplayModeBase|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Entity\EntityDisplayModeBase|\PHPUnit_Framework_MockObject_MockObject
*/
protected $entity;
@ -94,7 +94,7 @@ class EntityDisplayModeBaseUnitTest extends UnitTestCase {
->with($this->entityType)
->will($this->returnValue($this->entityInfo));
$this->entity = $this->getMockBuilder('\Drupal\entity\EntityDisplayModeBase')
$this->entity = $this->getMockBuilder('\Drupal\Core\Entity\EntityDisplayModeBase')
->setConstructorArgs(array($values, $this->entityType))
->setMethods(array('getFilterFormat'))
->getMock();