diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Controller/FieldInstanceListController.php b/core/modules/field_ui/lib/Drupal/field_ui/Controller/FieldInstanceListController.php index 3d32c17..26c902d 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Controller/FieldInstanceListController.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Controller/FieldInstanceListController.php @@ -31,7 +31,7 @@ class FieldInstanceListController extends EntityListController { public function listing($entity_type = NULL, $bundle = NULL, Request $request = NULL) { if (!$bundle) { $entity_info = $this->entityManager()->getDefinition($entity_type); - $bundle = $request->attributes->get('_raw_variables')->get($entity_info['bundle_entity_type']); + $bundle = $request->attributes->get('_raw_variables')->get($entity_info->getBundleEntityType()); } return $this->entityManager()->getListController('field_instance')->render($entity_type, $bundle, $request); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index aec6c53..4efe290 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -12,12 +12,13 @@ use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldTypePluginManager; +use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Field UI display overview base class. */ -abstract class DisplayOverviewBase extends OverviewBase { +abstract class DisplayOverviewBase extends FormBase { /** * The name of the entity type. @@ -131,7 +132,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, if (!isset($form_state['bundle'])) { if (!$bundle) { $entity_info = $this->entityManager->getDefinition($entity_type); - $bundle = $this->getRequest()->attributes->get('_raw_variables')->get($entity_info['bundle_entity_type']); + $bundle = $this->getRequest()->attributes->get('_raw_variables')->get($entity_info->getBundleEntityType()); } $form_state['bundle'] = $bundle; } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceListController.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceListController.php index c7ad5ce..4e693cd 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceListController.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldInstanceListController.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListController; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldTypePluginManager; use Drupal\Component\Utility\String; @@ -23,13 +24,6 @@ class FieldInstanceListController extends ConfigEntityListController { /** - * The name of the entity type. - * - * @var string - */ - protected $entityType; - - /** * The entity bundle. * * @var string @@ -67,11 +61,10 @@ class FieldInstanceListController extends ConfigEntityListController { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) { + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_info) { return new static( - $entity_type, $entity_info, - $container->get('entity.manager')->getStorageController($entity_type), + $container->get('entity.manager')->getStorageController($entity_info->id()), $container->get('module_handler'), $container->get('field.info'), $container->get('plugin.manager.field.field_type') @@ -81,10 +74,8 @@ public static function createInstance(ContainerInterface $container, $entity_typ /** * Constructs a new EntityListController object. * - * @param string $entity_type - * The type of entity to be listed. - * @param array $entity_info - * An array of entity info for the entity type. + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info + * The entity info for the entity type. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage * The entity storage controller class. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler @@ -94,8 +85,8 @@ public static function createInstance(ContainerInterface $container, $entity_typ * @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager * The field type manager */ - public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler, FieldInfo $field_info, FieldTypePluginManager $field_type_manager) { - parent::__construct($entity_type, $entity_info, $storage, $module_handler); + public function __construct(EntityTypeInterface $entity_info, EntityStorageControllerInterface $storage, ModuleHandlerInterface $module_handler, FieldInfo $field_info, FieldTypePluginManager $field_type_manager) { + parent::__construct($entity_info, $storage, $module_handler); $this->fieldInfo = $field_info; $this->fieldTypeManager = $field_type_manager; @@ -131,7 +122,7 @@ public function render($entity_type = NULL, $bundle = NULL, Request $request = N */ public function load() { $entities = $this->fieldInfo->getBundleInstances($this->entityType, $this->bundle); - uasort($entities, array($this->entityInfo['class'], 'sort')); + uasort($entities, array($this->entityInfo->getClass(), 'sort')); return $entities; } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldAddForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldAddForm.php index 28d42ab..9dae33f 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldAddForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldAddForm.php @@ -112,7 +112,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, if (!isset($form_state['bundle'])) { if (!$bundle) { $entity_info = $this->entityManager->getDefinition($entity_type); - $bundle = $this->getRequest()->attributes->get('_raw_variables')->get($entity_info['bundle_entity_type']); + $bundle = $this->getRequest()->attributes->get('_raw_variables')->get($entity_info->getBundleEntityType()); } $form_state['bundle'] = $bundle; } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalAction.php b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalAction.php index 5ac6a06..210527b 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalAction.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalAction.php @@ -61,8 +61,8 @@ public static function create(ContainerInterface $container, $base_plugin_id) { public function getDerivativeDefinitions(array $base_plugin_definition) { $this->derivatives = array(); - foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) { - if ($entity_info['fieldable'] && isset($entity_info['links']['admin-form'])) { + foreach ($this->entityManager->getDefinitions() as $entity_type => $info) { + if ($info->isFieldable() && $info->hasLinkTemplate('admin-form')) { $this->derivatives["add_$entity_type"] = array( 'route_name' => "field_ui.add_$entity_type", 'title' => $this->t('Add field'),