diff --git a/core/config/schema/core.entity.schema.yml b/core/config/schema/core.entity.schema.yml index 4afb536..2d1b7dc 100644 --- a/core/config/schema/core.entity.schema.yml +++ b/core/config/schema/core.entity.schema.yml @@ -54,9 +54,6 @@ core.entity_view_display.*.*.*: id: type: string label: 'ID' - label: - type: label - label: 'Label' targetEntityType: type: string label: 'Target entity type' diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 285df5a..5a45f88 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -399,6 +399,7 @@ public function __sleep() { // Only store the definition, not external objects or derived data. $keys = array_keys($this->toArray()); $keys[] = 'entityTypeId'; + $keys[] = 'enforceIsNew'; return $keys; } @@ -408,7 +409,9 @@ public function __sleep() { public function __wakeup() { // Run the values from self::toArray() through __construct(). $values = array_intersect_key($this->toArray(), get_object_vars($this)); + $is_new = $this->isNew(); $this->__construct($values, $this->entityTypeId); + $this->enforceIsNew($is_new); } } diff --git a/core/modules/book/config/install/core.entity_view_display.node.book.default.yml b/core/modules/book/config/install/core.entity_view_display.node.book.default.yml index e4f76fd..ff46c58 100644 --- a/core/modules/book/config/install/core.entity_view_display.node.book.default.yml +++ b/core/modules/book/config/install/core.entity_view_display.node.book.default.yml @@ -8,7 +8,6 @@ dependencies: - text - user id: node.book.default -label: null targetEntityType: node bundle: book mode: default diff --git a/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml b/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml index 4e2dd37..61920f4 100644 --- a/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml +++ b/core/modules/book/config/install/core.entity_view_display.node.book.teaser.yml @@ -9,7 +9,6 @@ dependencies: - text - user id: node.book.teaser -label: null targetEntityType: node bundle: book mode: teaser diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index e305b79..920d938 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -11,6 +11,7 @@ use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Entity\EntityViewModeInterface; +use Drupal\Core\Url; use Drupal\field_ui\FieldUI; use Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask; @@ -68,6 +69,8 @@ function field_ui_entity_type_build(array &$entity_types) { $entity_types['field_config']->setListBuilderClass('Drupal\field_ui\FieldConfigListBuilder'); $entity_types['field_storage_config']->setListBuilderClass('Drupal\field_ui\FieldStorageConfigListBuilder'); $entity_types['field_storage_config']->setLinkTemplate('collection', '/admin/reports/fields'); + $entity_types['entity_form_display']->setFormClass('edit', 'Drupal\field_ui\Form\EntityFormDisplayEditForm'); + $entity_types['entity_view_display']->setFormClass('edit', 'Drupal\field_ui\Form\EntityViewDisplayEditForm'); foreach ($entity_types as $entity_type) { if ($bundle = $entity_type->getBundleOf()) { @@ -76,9 +79,7 @@ function field_ui_entity_type_build(array &$entity_types) { // This allows us to not require route information inside this hook, which // otherwise could result in circular dependencies. $entity_type - ->setLinkTemplate('field_ui-fields', "/admin/{$entity_type->id()}/fields") - ->setLinkTemplate('field_ui-form-display', "/admin/{$entity_type->id()}/fields-form-display") - ->setLinkTemplate('field_ui-display', "/admin/{$entity_type->id()}/fields-display"); + ->setLinkTemplate('field_ui-fields', "/admin/{$entity_type->id()}/fields"); } } } @@ -143,14 +144,18 @@ function field_ui_entity_operation(EntityInterface $entity) { $operations['manage-form-display'] = array( 'title' => t('Manage form display'), 'weight' => 20, - 'url' => $entity->urlInfo('field_ui-form-display'), + 'url' => Url::fromRoute("entity.entity_form_display.{$entity->getEntityTypeId()}.default", array( + $entity->getEntityTypeId() => $entity->id(), + )), ); } if ($account->hasPermission('administer '. $bundle_of . ' display')) { $operations['manage-display'] = array( 'title' => t('Manage display'), 'weight' => 25, - 'url' => $entity->urlInfo('field_ui-display'), + 'url' => Url::fromRoute("entity.entity_view_display.{$entity->getEntityTypeId()}.default", array( + $entity->getEntityTypeId() => $entity->id(), + )), ); } } diff --git a/core/modules/field_ui/src/DisplayOverviewBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php similarity index 87% rename from core/modules/field_ui/src/DisplayOverviewBase.php rename to core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 307a9bb..6705274 100644 --- a/core/modules/field_ui/src/DisplayOverviewBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -2,44 +2,30 @@ /** * @file - * Contains \Drupal\field_ui\DisplayOverviewBase. + * Contains \Drupal\field_ui\Form\EntityDisplayFormBase. */ -namespace Drupal\field_ui; +namespace Drupal\field_ui\Form; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Component\Plugin\PluginManagerBase; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\String; -use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityForm; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityWithPluginCollectionInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldTypePluginManagerInterface; use Drupal\Core\Field\PluginSettingsInterface; -use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\field_ui\FieldUI; /** - * Field UI display overview base class. + * Base class for EntityDisplay edit forms. */ -abstract class DisplayOverviewBase extends FormBase { - - /** - * The name of the entity type. - * - * @var string - */ - protected $entity_type = ''; - - /** - * The entity bundle. - * - * @var string - */ - protected $bundle = ''; +abstract class EntityDisplayFormBase extends EntityForm { /** * The name of the entity type which provides bundles for the entity type @@ -50,20 +36,6 @@ protected $bundleEntityTypeId; /** - * The entity view or form mode. - * - * @var string - */ - protected $mode = ''; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityManagerInterface - */ - protected $entityManager; - - /** * The display context. Either 'view' or 'form'. * * @var string @@ -85,41 +57,41 @@ protected $fieldTypes; /** - * The config factory. + * The entity being used by this form. * - * @var \Drupal\Core\Config\ConfigFactoryInterface + * @var \Drupal\Core\Entity\Display\EntityDisplayInterface */ - protected $configFactory; + protected $entity; /** - * Constructs a new DisplayOverviewBase. + * Constructs a new EntityDisplayFormBase. * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager * The field type manager. * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager * The widget or formatter plugin manager. - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * The configuration factory. */ - public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, ConfigFactoryInterface $config_factory) { - $this->entityManager = $entity_manager; + public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager) { $this->fieldTypes = $field_type_manager->getDefinitions(); $this->pluginManager = $plugin_manager; - $this->configFactory = $config_factory; } /** * {@inheritdoc} */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager'), - $container->get('plugin.manager.field.field_type'), - $container->get('plugin.manager.field.widget'), - $container->get('config.factory') - ); + public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) { + $route_parameters = $route_match->getParameters()->all(); + + if (isset($route_parameters['bundle'])) { + $bundle = $route_parameters['bundle']; + } + else { + $target_entity_type = $this->entityManager->getDefinition($route_parameters['entity_type_id']); + $this->bundleEntityTypeId = $target_entity_type->getBundleEntityType(); + $bundle = $route_parameters[$this->bundleEntityTypeId]->id(); + } + + return $this->getEntityDisplay($route_parameters['entity_type_id'], $bundle, $route_parameters[$this->displayContext . '_mode_name']); } /** @@ -177,7 +149,7 @@ public function getRegionOptions() { */ protected function getFieldDefinitions() { $context = $this->displayContext; - return array_filter($this->entityManager->getFieldDefinitions($this->entity_type, $this->bundle), function(FieldDefinitionInterface $field_definition) use ($context) { + return array_filter($this->entityManager->getFieldDefinitions($this->entity->targetEntityType, $this->entity->bundle), function(FieldDefinitionInterface $field_definition) use ($context) { return $field_definition->isDisplayConfigurable($context); }); } @@ -185,32 +157,20 @@ protected function getFieldDefinitions() { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL, $bundle = NULL, $mode = 'default') { - $entity_type = $this->entityManager->getDefinition($entity_type_id); - $this->bundleEntityTypeId = $entity_type->getBundleEntityType(); - - if (!$form_state->get('bundle')) { - $bundle = $bundle ?: $this->getRequest()->attributes->get('_raw_variables')->get($this->bundleEntityTypeId); - $form_state->set('bundle', $bundle); - } - - $this->entity_type = $entity_type_id; - $this->bundle = $form_state->get('bundle'); - $this->mode = $mode; + public function form(array $form, FormStateInterface $form_state) { + $form = parent::form($form, $form_state); $field_definitions = $this->getFieldDefinitions(); $extra_fields = $this->getExtraFields(); - $entity_display = $this->getEntityDisplay($this->mode); $form += array( - '#entity_type' => $this->entity_type, - '#bundle' => $this->bundle, - '#mode' => $this->mode, + '#entity_type' => $this->entity->targetEntityType, + '#bundle' => $this->entity->bundle, '#fields' => array_keys($field_definitions), '#extra' => array_keys($extra_fields), ); - if (empty($field_definitions) && empty($extra_fields) && $route_info = FieldUI::getOverviewRouteInfo($this->entity_type, $this->bundle)) { + if (empty($field_definitions) && empty($extra_fields) && $route_info = FieldUI::getOverviewRouteInfo($this->entity->targetEntityType, $this->entity->bundle)) { drupal_set_message($this->t('There are no fields yet added. You can add new fields on the Manage fields page.', array('@link' => $route_info->toString())), 'warning'); return $form; } @@ -246,18 +206,18 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t // Field rows. foreach ($field_definitions as $field_name => $field_definition) { - $table[$field_name] = $this->buildFieldRow($field_definition, $entity_display, $form, $form_state); + $table[$field_name] = $this->buildFieldRow($field_definition, $form, $form_state); } // Non-field elements. foreach ($extra_fields as $field_id => $extra_field) { - $table[$field_id] = $this->buildExtraFieldRow($field_id, $extra_field, $entity_display); + $table[$field_id] = $this->buildExtraFieldRow($field_id, $extra_field); } $form['fields'] = $table; // Custom display settings. - if ($this->mode == 'default') { + if ($this->entity->mode == 'default') { // Only show the settings if there is at least one custom display mode. if ($display_modes = $this->getDisplayModes()) { $form['modes'] = array( @@ -324,8 +284,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The field definition. - * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $entity_display - * The entity display. * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state @@ -334,9 +292,9 @@ public function buildForm(array $form, FormStateInterface $form_state, $entity_t * @return array * A table row array. */ - protected function buildFieldRow(FieldDefinitionInterface $field_definition, EntityDisplayInterface $entity_display, array $form, FormStateInterface $form_state) { + protected function buildFieldRow(FieldDefinitionInterface $field_definition, array $form, FormStateInterface $form_state) { $field_name = $field_definition->getName(); - $display_options = $entity_display->getComponent($field_name); + $display_options = $this->entity->getComponent($field_name); $label = $field_definition->getLabel(); $regions = array_keys($this->getRegions()); @@ -514,14 +472,12 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent * The field ID. * @param array $extra_field * The pseudo-field element. - * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $entity_display - * The entity display. * * @return array * A table row array. */ - protected function buildExtraFieldRow($field_id, $extra_field, EntityDisplayInterface $entity_display) { - $display_options = $entity_display->getComponent($field_id); + protected function buildExtraFieldRow($field_id, $extra_field) { + $display_options = $this->entity->getComponent($field_id); $regions = array_keys($this->getRegions()); $extra_field_row = array( @@ -578,8 +534,48 @@ protected function buildExtraFieldRow($field_id, $extra_field, EntityDisplayInte * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { + parent::submitForm($form, $form_state); $form_values = $form_state->getValues(); - $display = $this->getEntityDisplay($this->mode); + + // Handle the 'display modes' checkboxes if present. + if ($this->entity->mode == 'default' && !empty($form_values['display_modes_custom'])) { + $display_modes = $this->getDisplayModes(); + $current_statuses = $this->getDisplayStatuses(); + + $statuses = array(); + foreach ($form_values['display_modes_custom'] as $mode => $value) { + if (!empty($value) && empty($current_statuses[$mode])) { + // If no display exists for the newly enabled view mode, initialize + // it with those from the 'default' view mode, which were used so + // far. + if (!$this->entityManager->getStorage($this->entity->getEntityTypeId())->load($this->entity->targetEntityType . '.' . $this->entity->bundle . '.' . $mode)) { + $display = $this->getEntityDisplay($this->entity->targetEntityType, $this->entity->bundle, 'default')->createCopy($mode); + $display->save(); + } + + $display_mode_label = $display_modes[$mode]['label']; + $url = $this->getOverviewUrl($mode); + drupal_set_message($this->t('The %display_mode mode now uses custom display settings. You might want to configure them.', ['%display_mode' => $display_mode_label, '@url' => $url->toString()])); + } + $statuses[$mode] = !empty($value); + } + + $this->saveDisplayStatuses($statuses); + } + + drupal_set_message($this->t('Your settings have been saved.')); + } + + /** + * {@inheritdoc} + */ + protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) { + $form_values = $form_state->getValues(); + + if ($this->entity instanceof EntityWithPluginCollectionInterface) { + // Do not manually update values represented by plugin collections. + $form_values = array_diff_key($form_values, $this->entity->getPluginCollections()); + } // Collect data for 'regular' fields. foreach ($form['#fields'] as $field_name) { @@ -588,7 +584,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $values = $form_values['fields'][$field_name]; if ($values['type'] == 'hidden') { - $display->removeComponent($field_name); + $entity->removeComponent($field_name); } else { // Get plugin settings. They lie either directly in submitted form @@ -602,7 +598,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { elseif (isset($plugin_settings[$field_name]['settings'])) { $settings = $plugin_settings[$field_name]['settings']; } - elseif ($current_options = $display->getComponent($field_name)) { + elseif ($current_options = $entity->getComponent($field_name)) { $settings = $current_options['settings']; } $third_party_settings = array(); @@ -612,7 +608,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { elseif (isset($plugin_settings[$field_name]['third_party_settings'])) { $third_party_settings = $plugin_settings[$field_name]['third_party_settings']; } - elseif (($current_options = $display->getComponent($field_name)) && isset($current_options['third_party_settings'])) { + elseif (($current_options = $entity->getComponent($field_name)) && isset($current_options['third_party_settings'])) { $third_party_settings = $current_options['third_party_settings']; } @@ -633,52 +629,21 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $component_values['label'] = $values['label']; } - $display->setComponent($field_name, $component_values); + $entity->setComponent($field_name, $component_values); } } // Collect data for 'extra' fields. foreach ($form['#extra'] as $name) { if ($form_values['fields'][$name]['type'] == 'hidden') { - $display->removeComponent($name); + $entity->removeComponent($name); } else { - $display->setComponent($name, array( + $entity->setComponent($name, array( 'weight' => $form_values['fields'][$name]['weight'], )); } } - - // Save the display. - $display->save(); - - // Handle the 'display modes' checkboxes if present. - if ($this->mode == 'default' && !empty($form_values['display_modes_custom'])) { - $display_modes = $this->getDisplayModes(); - $current_statuses = $this->getDisplayStatuses(); - - $statuses = array(); - foreach ($form_values['display_modes_custom'] as $mode => $value) { - if (!empty($value) && empty($current_statuses[$mode])) { - // If no display exists for the newly enabled view mode, initialize - // it with those from the 'default' view mode, which were used so - // far. - if (!entity_load($this->getEntityDisplay('default')->getEntityTypeId(), $this->entity_type . '.' . $this->bundle . '.' . $mode)) { - $display = $this->getEntityDisplay('default')->createCopy($mode); - $display->save(); - } - - $display_mode_label = $display_modes[$mode]['label']; - $url = $this->getOverviewRoute($mode); - drupal_set_message($this->t('The %display_mode mode now uses custom display settings. You might want to configure them.', ['%display_mode' => $display_mode_label, '@url' => $url->toString()])); - } - $statuses[$mode] = !empty($value); - } - - $this->saveDisplayStatuses($statuses); - } - - drupal_set_message($this->t('Your settings have been saved.')); } /** @@ -865,7 +830,7 @@ public function tablePreRender($elements) { * Determines the rendering order of an array representing a tree. * * Callback for array_reduce() within - * \Drupal\field_ui\DisplayOverviewBase::tablePreRender(). + * \Drupal\field_ui\Form\EntityDisplayFormBase::tablePreRender(). */ public function reduceOrder($array, $a) { $array = !isset($array) ? array() : $array; @@ -880,17 +845,6 @@ public function reduceOrder($array, $a) { } /** - * Returns the entity display object used by this form. - * - * @param string $mode - * A view or form mode. - * - * @return \Drupal\Core\Entity\Display\EntityDisplayInterface - * An entity display. - */ - abstract protected function getEntityDisplay($mode); - - /** * Returns the extra fields of the entity type and bundle used by this form. * * @return array @@ -900,11 +854,26 @@ public function reduceOrder($array, $a) { */ protected function getExtraFields() { $context = $this->displayContext == 'view' ? 'display' : $this->displayContext; - $extra_fields = $this->entityManager->getExtraFields($this->entity_type, $this->bundle); + $extra_fields = $this->entityManager->getExtraFields($this->entity->targetEntityType, $this->entity->bundle); return isset($extra_fields[$context]) ? $extra_fields[$context] : array(); } /** + * Returns an entity display object to be used by this form. + * + * @param string $entity_type_id + * The target entity type ID of the entity display. + * @param string $bundle + * The target bundle of the entity display. + * @param string $mode + * A view or form mode. + * + * @return \Drupal\Core\Entity\Display\EntityDisplayInterface + * An entity display. + */ + abstract protected function getEntityDisplay($entity_type_id, $bundle, $mode); + + /** * Returns the widget or formatter plugin for a field. * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition @@ -935,7 +904,7 @@ protected function getPluginOptions(FieldDefinitionInterface $field_definition) $applicable_options[$option] = $label; } } - return $applicable_options; + return $applicable_options + array('hidden' => '- ' . $this->t('Hidden') . ' -'); } /** @@ -958,14 +927,6 @@ protected function getPluginOptions(FieldDefinitionInterface $field_definition) abstract protected function getDisplayModes(); /** - * Returns the display entity type. - * - * @return string - * The name of the display entity type. - */ - abstract protected function getDisplayType(); - - /** * Returns the region to which a row in the display overview belongs. * * @param array $row @@ -998,15 +959,15 @@ protected function getExtraFieldVisibilityOptions() { /** * Returns entity (form) displays for the current entity display type. * - * @return array + * @return \Drupal\Core\Entity\Display\EntityDisplayInterface[] * An array holding entity displays or entity form displays. */ protected function getDisplays() { $load_ids = array(); - $display_entity_type = $this->getDisplayType(); + $display_entity_type = $this->entity->getEntityTypeId(); $entity_type = $this->entityManager->getDefinition($display_entity_type); $config_prefix = $entity_type->getConfigPrefix(); - $ids = $this->configFactory->listAll($config_prefix . '.' . $this->entity_type . '.' . $this->bundle . '.'); + $ids = $this->configFactory()->listAll($config_prefix . '.' . $this->entity->targetEntityType . '.' . $this->entity->bundle . '.'); foreach ($ids as $id) { $config_id = str_replace($config_prefix . '.', '', $id); list(,, $display_mode) = explode('.', $config_id); @@ -1014,7 +975,7 @@ protected function getDisplays() { $load_ids[] = $config_id; } } - return entity_load_multiple($display_entity_type, $load_ids); + return $this->entityManager->getStorage($display_entity_type)->loadMultiple($load_ids); } /** @@ -1055,7 +1016,7 @@ protected function saveDisplayStatuses($display_statuses) { abstract protected function getTableHeader(); /** - * Returns the route info of a specific form or view mode form. + * Returns the Url object for a specific entity (form) display edit form. * * @param string $mode * The form or view mode. @@ -1063,7 +1024,7 @@ protected function saveDisplayStatuses($display_statuses) { * @return \Drupal\Core\Url * A Url object for the overview route. */ - abstract protected function getOverviewRoute($mode); + abstract protected function getOverviewUrl($mode); /** * Adds the widget or formatter third party settings forms. diff --git a/core/modules/field_ui/src/FormDisplayOverview.php b/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php similarity index 51% rename from core/modules/field_ui/src/FormDisplayOverview.php rename to core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php index dd3363f..0120cd5 100644 --- a/core/modules/field_ui/src/FormDisplayOverview.php +++ b/core/modules/field_ui/src/Form/EntityFormDisplayEditForm.php @@ -2,27 +2,21 @@ /** * @file - * Contains \Drupal\field_ui\FormDisplayOverview. + * Contains \Drupal\field_ui\Form\EntityFormDisplayEditForm. */ -namespace Drupal\field_ui; +namespace Drupal\field_ui\Form; -use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Field\FieldTypePluginManager; use Drupal\Core\Field\PluginSettingsInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Field UI form display overview form. + * Edit form for the EntityFormDisplay entity type. */ -class FormDisplayOverview extends DisplayOverviewBase { +class EntityFormDisplayEditForm extends EntityDisplayFormBase { /** * {@inheritdoc} @@ -30,69 +24,26 @@ class FormDisplayOverview extends DisplayOverviewBase { protected $displayContext = 'form'; /** - * Stores the module manager. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a new class instance. - * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. - * @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager - * The field type manager. - * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager - * The widget or formatter plugin manager. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to use for invoking hooks. - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * The configuration factory. - */ - public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) { - parent::__construct($entity_manager, $field_type_manager, $plugin_manager, $config_factory); - $this->moduleHandler = $module_handler; - } - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), $container->get('plugin.manager.field.field_type'), - $container->get('plugin.manager.field.widget'), - $container->get('module_handler'), - $container->get('config.factory') + $container->get('plugin.manager.field.widget') ); } /** * {@inheritdoc} */ - public function getFormId() { - return 'field_ui_form_display_overview_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL, $bundle = NULL, $form_mode_name = 'default') { - return parent::buildForm($form, $form_state, $entity_type_id, $bundle, $form_mode_name); - } - - /** - * {@inheritdoc} - */ - protected function buildFieldRow(FieldDefinitionInterface $field_definition, EntityDisplayInterface $entity_display, array $form, FormStateInterface $form_state) { - $field_row = parent::buildFieldRow($field_definition, $entity_display, $form, $form_state); + protected function buildFieldRow(FieldDefinitionInterface $field_definition, array $form, FormStateInterface $form_state) { + $field_row = parent::buildFieldRow($field_definition, $form, $form_state); $field_name = $field_definition->getName(); // Update the (invisible) title of the 'plugin' column. $field_row['plugin']['#title'] = $this->t('Formatter for @title', array('@title' => $field_definition->getLabel())); - if (!empty($field_row['plugin']['settings_edit_form']) && ($plugin = $entity_display->getRenderer($field_name))) { + if (!empty($field_row['plugin']['settings_edit_form']) && ($plugin = $this->entity->getRenderer($field_name))) { $plugin_type_info = $plugin->getPluginDefinition(); $field_row['plugin']['settings_edit_form']['label']['#markup'] = $this->t('Widget settings:') . ' ' . $plugin_type_info['label'] . ''; } @@ -103,8 +54,8 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent /** * {@inheritdoc} */ - protected function getEntityDisplay($mode) { - return entity_get_form_display($this->entity_type, $this->bundle, $mode); + protected function getEntityDisplay($entity_type_id, $bundle, $mode) { + return entity_get_form_display($entity_type_id, $bundle, $mode); } /** @@ -116,7 +67,7 @@ protected function getPlugin(FieldDefinitionInterface $field_definition, $config if ($configuration && $configuration['type'] != 'hidden') { $plugin = $this->pluginManager->getInstance(array( 'field_definition' => $field_definition, - 'form_mode' => $this->mode, + 'form_mode' => $this->entity->mode, 'configuration' => $configuration )); } @@ -127,13 +78,6 @@ protected function getPlugin(FieldDefinitionInterface $field_definition, $config /** * {@inheritdoc} */ - protected function getPluginOptions(FieldDefinitionInterface $field_definition) { - return parent::getPluginOptions($field_definition) + array('hidden' => '- ' . t('Hidden') . ' -'); - } - - /** - * {@inheritdoc} - */ protected function getDefaultPlugin($field_type) { return isset($this->fieldTypes[$field_type]['default_widget']) ? $this->fieldTypes[$field_type]['default_widget'] : NULL; } @@ -142,14 +86,7 @@ protected function getDefaultPlugin($field_type) { * {@inheritdoc} */ protected function getDisplayModes() { - return $this->entityManager->getFormModes($this->entity_type); - } - - /** - * {@inheritdoc} - */ - protected function getDisplayType() { - return 'entity_form_display'; + return $this->entityManager->getFormModes($this->entity->targetEntityType); } /** @@ -167,11 +104,11 @@ protected function getTableHeader() { /** * {@inheritdoc} */ - protected function getOverviewRoute($mode) { - $entity_type = $this->entityManager->getDefinition($this->entity_type); + protected function getOverviewUrl($mode) { + $entity_type = $this->entityManager->getDefinition($this->entity->targetEntityType); $field_entity_type = $entity_type->getBundleEntityType() != 'bundle'? $entity_type->getBundleEntityType() : $entity_type->id(); - return Url::fromRoute('field_ui.form_display_overview_form_mode_' . $field_entity_type, [ - $this->bundleEntityTypeId => $this->bundle, + return Url::fromRoute('entity.entity_form_display.' . $field_entity_type . '.form_mode', [ + $this->bundleEntityTypeId => $this->entity->bundle, 'form_mode_name' => $mode, ]); } @@ -187,7 +124,7 @@ protected function thirdPartySettingsForm(PluginSettingsInterface $plugin, Field $settings_form[$module] = $this->moduleHandler->invoke($module, 'field_widget_third_party_settings_form', array( $plugin, $field_definition, - $this->mode, + $this->entity->mode, $form, $form_state, )); @@ -202,7 +139,7 @@ protected function alterSettingsSummary(array &$summary, PluginSettingsInterface $context = array( 'widget' => $plugin, 'field_definition' => $field_definition, - 'form_mode' => $this->mode, + 'form_mode' => $this->entity->mode, ); $this->moduleHandler->alter('field_widget_settings_summary', $summary, $context); } diff --git a/core/modules/field_ui/src/DisplayOverview.php b/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php similarity index 59% rename from core/modules/field_ui/src/DisplayOverview.php rename to core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php index 5d6fd59..55abe97 100644 --- a/core/modules/field_ui/src/DisplayOverview.php +++ b/core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php @@ -2,28 +2,21 @@ /** * @file - * Contains \Drupal\field_ui\DisplayOverview. + * Contains \Drupal\field_ui\Form\EntityViewDisplayEditForm. */ -namespace Drupal\field_ui; +namespace Drupal\field_ui\Form; -use Drupal\Component\Plugin\PluginManagerBase; -use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Field\FieldTypePluginManager; -use Drupal\Core\Field\FormatterInterface; use Drupal\Core\Field\PluginSettingsInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * Field UI display overview form. + * Edit form for the EntityViewDisplay entity type. */ -class DisplayOverview extends DisplayOverviewBase { +class EntityViewDisplayEditForm extends EntityDisplayFormBase { /** * {@inheritdoc} @@ -31,66 +24,23 @@ class DisplayOverview extends DisplayOverviewBase { protected $displayContext = 'view'; /** - * Stores the module manager. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a new class instance. - * - * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager - * The entity manager. - * @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager - * The field type manager. - * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager - * The widget or formatter plugin manager. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler class to use for invoking hooks. - * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory - * The configuration factory. - */ - public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) { - parent::__construct($entity_manager, $field_type_manager, $plugin_manager, $config_factory); - $this->moduleHandler = $module_handler; - } - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( - $container->get('entity.manager'), $container->get('plugin.manager.field.field_type'), - $container->get('plugin.manager.field.formatter'), - $container->get('module_handler'), - $container->get('config.factory') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'field_ui_display_overview_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL, $bundle = NULL, $view_mode_name = 'default') { - return parent::buildForm($form, $form_state, $entity_type_id, $bundle, $view_mode_name); + $container->get('plugin.manager.field.formatter') + ); } /** * {@inheritdoc} */ - protected function buildFieldRow(FieldDefinitionInterface $field_definition, EntityDisplayInterface $entity_display, array $form, FormStateInterface $form_state) { - $field_row = parent::buildFieldRow($field_definition, $entity_display, $form, $form_state); + protected function buildFieldRow(FieldDefinitionInterface $field_definition, array $form, FormStateInterface $form_state) { + $field_row = parent::buildFieldRow($field_definition, $form, $form_state); $field_name = $field_definition->getName(); - $display_options = $entity_display->getComponent($field_name); + $display_options = $this->entity->getComponent($field_name); // Insert the label column. $label = array( @@ -108,7 +58,7 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent // Update the (invisible) title of the 'plugin' column. $field_row['plugin']['#title'] = $this->t('Formatter for @title', array('@title' => $field_definition->getLabel())); - if (!empty($field_row['plugin']['settings_edit_form']) && ($plugin = $entity_display->getRenderer($field_name))) { + if (!empty($field_row['plugin']['settings_edit_form']) && ($plugin = $this->entity->getRenderer($field_name))) { $plugin_type_info = $plugin->getPluginDefinition(); $field_row['plugin']['settings_edit_form']['label']['#markup'] = $this->t('Format settings:') . ' ' . $plugin_type_info['label'] . ''; } @@ -119,8 +69,8 @@ protected function buildFieldRow(FieldDefinitionInterface $field_definition, Ent /** * {@inheritdoc} */ - protected function buildExtraFieldRow($field_id, $extra_field, EntityDisplayInterface $entity_display) { - $extra_field_row = parent::buildExtraFieldRow($field_id, $extra_field, $entity_display); + protected function buildExtraFieldRow($field_id, $extra_field) { + $extra_field_row = parent::buildExtraFieldRow($field_id, $extra_field); // Insert an empty placeholder for the label column. $label = array( @@ -137,8 +87,8 @@ protected function buildExtraFieldRow($field_id, $extra_field, EntityDisplayInte /** * {@inheritdoc} */ - protected function getEntityDisplay($mode) { - return entity_get_display($this->entity_type, $this->bundle, $mode); + protected function getEntityDisplay($entity_type_id, $bundle, $mode) { + return entity_get_display($entity_type_id, $bundle, $mode); } /** @@ -150,7 +100,7 @@ protected function getPlugin(FieldDefinitionInterface $field_definition, $config if ($configuration && $configuration['type'] != 'hidden') { $plugin = $this->pluginManager->getInstance(array( 'field_definition' => $field_definition, - 'view_mode' => $this->mode, + 'view_mode' => $this->entity->mode, 'configuration' => $configuration )); } @@ -161,13 +111,6 @@ protected function getPlugin(FieldDefinitionInterface $field_definition, $config /** * {@inheritdoc} */ - protected function getPluginOptions(FieldDefinitionInterface $field_definition) { - return parent::getPluginOptions($field_definition) + array('hidden' => '- ' . $this->t('Hidden') . ' -'); - } - - /** - * {@inheritdoc} - */ protected function getDefaultPlugin($field_type) { return isset($this->fieldTypes[$field_type]['default_formatter']) ? $this->fieldTypes[$field_type]['default_formatter'] : NULL; } @@ -176,14 +119,7 @@ protected function getDefaultPlugin($field_type) { * {@inheritdoc} */ protected function getDisplayModes() { - return $this->entityManager->getViewModes($this->entity_type); - } - - /** - * {@inheritdoc} - */ - protected function getDisplayType() { - return 'entity_view_display'; + return $this->entityManager->getViewModes($this->entity->targetEntityType); } /** @@ -202,11 +138,11 @@ protected function getTableHeader() { /** * {@inheritdoc} */ - protected function getOverviewRoute($mode) { - $entity_type = $this->entityManager->getDefinition($this->entity_type); + protected function getOverviewUrl($mode) { + $entity_type = $this->entityManager->getDefinition($this->entity->targetEntityType); $field_entity_type = $entity_type->getBundleEntityType() != 'bundle'? $entity_type->getBundleEntityType() : $entity_type->id(); - return Url::fromRoute('field_ui.display_overview_view_mode_' . $field_entity_type, [ - $this->bundleEntityTypeId => $this->bundle, + return Url::fromRoute('entity.entity_view_display.' . $field_entity_type . '.view_mode', [ + $this->bundleEntityTypeId => $this->entity->bundle, 'view_mode_name' => $mode, ]); } @@ -237,7 +173,7 @@ protected function thirdPartySettingsForm(PluginSettingsInterface $plugin, Field $settings_form[$module] = $this->moduleHandler->invoke($module, 'field_formatter_third_party_settings_form', array( $plugin, $field_definition, - $this->mode, + $this->entity->mode, $form, $form_state, )); @@ -252,7 +188,7 @@ protected function alterSettingsSummary(array &$summary, PluginSettingsInterface $context = array( 'formatter' => $plugin, 'field_definition' => $field_definition, - 'view_mode' => $this->mode, + 'view_mode' => $this->entity->mode, ); $this->moduleHandler->alter('field_formatter_settings_summary', $summary, $context); } diff --git a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php index 1a9f6d4..9b6652e 100644 --- a/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php @@ -82,7 +82,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { // 'Manage form display' tab. $this->derivatives["form_display_overview_$field_entity_type"] = array( - 'route_name' => "entity.{$field_entity_type}.field_ui_form_display", + 'route_name' => "entity.entity_form_display.$field_entity_type.default", 'weight' => 2, 'title' => $this->t('Manage form display'), 'base_route' => "entity.$field_entity_type.field_ui_fields", @@ -90,7 +90,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { // 'Manage display' tab. $this->derivatives["display_overview_$field_entity_type"] = array( - 'route_name' => "entity.{$field_entity_type}.field_ui_display", + 'route_name' => "entity.entity_view_display.$field_entity_type.default", 'weight' => 3, 'title' => $this->t('Manage display'), 'base_route' => "entity.$field_entity_type.field_ui_fields", @@ -119,13 +119,13 @@ public function getDerivativeDefinitions($base_plugin_definition) { // actually visible for a given bundle. $this->derivatives['field_form_display_default_' . $field_entity_type] = array( 'title' => 'Default', - 'route_name' => "entity.{$field_entity_type}.field_ui_form_display", + 'route_name' => "entity.entity_form_display.$field_entity_type.default", 'parent_id' => "field_ui.fields:form_display_overview_$field_entity_type", 'weight' => -1, ); $this->derivatives['field_display_default_' . $field_entity_type] = array( 'title' => 'Default', - 'route_name' => "entity.{$field_entity_type}.field_ui_display", + 'route_name' => "entity.entity_view_display.$field_entity_type.default", 'parent_id' => "field_ui.fields:display_overview_$field_entity_type", 'weight' => -1, ); @@ -135,7 +135,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getFormModes($entity_type_id) as $form_mode => $form_mode_info) { $this->derivatives['field_form_display_' . $form_mode . '_' . $field_entity_type] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.form_display_overview_form_mode_$field_entity_type", + 'route_name' => "entity.entity_form_display.$field_entity_type.form_mode", 'route_parameters' => array( 'form_mode_name' => $form_mode, ), @@ -149,7 +149,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getViewModes($entity_type_id) as $view_mode => $form_mode_info) { $this->derivatives['field_display_' . $view_mode . '_' . $field_entity_type] = array( 'title' => $form_mode_info['label'], - 'route_name' => "field_ui.display_overview_view_mode_$field_entity_type", + 'route_name' => "entity.entity_view_display.$field_entity_type.view_mode", 'route_parameters' => array( 'view_mode_name' => $view_mode, ), diff --git a/core/modules/field_ui/src/Routing/RouteSubscriber.php b/core/modules/field_ui/src/Routing/RouteSubscriber.php index b35d7a0..7715b7d 100644 --- a/core/modules/field_ui/src/Routing/RouteSubscriber.php +++ b/core/modules/field_ui/src/Routing/RouteSubscriber.php @@ -114,46 +114,48 @@ protected function alterRoutes(RouteCollection $collection) { $route = new Route( "$path/form-display", array( - '_form' => '\Drupal\field_ui\FormDisplayOverview', + '_entity_form' => 'entity_form_display.edit', '_title' => 'Manage form display', + 'form_mode_name' => 'default', ) + $defaults, array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display'), $options ); - $collection->add("entity.{$bundle_entity_type}.field_ui_form_display", $route); + $collection->add("entity.entity_form_display.$bundle_entity_type.default", $route); $route = new Route( "$path/form-display/{form_mode_name}", array( - '_form' => '\Drupal\field_ui\FormDisplayOverview', + '_entity_form' => 'entity_form_display.edit', '_title' => 'Manage form display', ) + $defaults, array('_field_ui_form_mode_access' => 'administer ' . $entity_type_id . ' form display'), $options ); - $collection->add("field_ui.form_display_overview_form_mode_$bundle_entity_type", $route); + $collection->add("entity.entity_form_display.$bundle_entity_type.form_mode", $route); $route = new Route( "$path/display", array( - '_form' => '\Drupal\field_ui\DisplayOverview', + '_entity_form' => 'entity_view_display.edit', '_title' => 'Manage display', + 'view_mode_name' => 'default', ) + $defaults, array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display'), $options ); - $collection->add("entity.{$bundle_entity_type}.field_ui_display", $route); + $collection->add("entity.entity_view_display.$bundle_entity_type.default", $route); $route = new Route( "$path/display/{view_mode_name}", array( - '_form' => '\Drupal\field_ui\DisplayOverview', + '_entity_form' => 'entity_view_display.edit', '_title' => 'Manage display', ) + $defaults, array('_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display'), $options ); - $collection->add("field_ui.display_overview_view_mode_$bundle_entity_type", $route); + $collection->add("entity.entity_view_display.$bundle_entity_type.view_mode", $route); } } } diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php index b97bc83..ac7d01f 100644 --- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php +++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php @@ -65,6 +65,7 @@ public function testFieldUIRoutes() { $edit = array('display_modes_custom[register]' => TRUE); $this->drupalPostForm(NULL, $edit, t('Save')); + $this->assertResponse(200); $this->drupalGet('admin/config/people/accounts/form-display/register'); $this->assertTitle('Manage form display | Drupal'); $this->assertLocalTasks(); diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index bf25fd0..5ba570d 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -164,6 +164,7 @@ function testFormatterUI() { // is no longer there. \Drupal::service('module_installer')->uninstall(array('field_third_party_test')); $this->drupalGet($manage_display); + $this->assertResponse(200); $this->assertNoFieldByName('field_test_settings_edit'); } diff --git a/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml b/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml index 065906f..624024f 100644 --- a/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.comment.comment_forum.default.yml @@ -7,7 +7,6 @@ dependencies: module: - text id: comment.comment_forum.default -label: null targetEntityType: comment bundle: comment_forum mode: default diff --git a/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml b/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml index c4462b2..70e589f 100644 --- a/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.node.forum.default.yml @@ -12,7 +12,6 @@ dependencies: - text - user id: node.forum.default -label: null targetEntityType: node bundle: forum mode: default diff --git a/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml b/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml index eedea3e..f8bc4fe 100644 --- a/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml +++ b/core/modules/forum/config/install/core.entity_view_display.node.forum.teaser.yml @@ -12,7 +12,6 @@ dependencies: - text - user id: node.forum.teaser -label: null targetEntityType: node bundle: forum mode: teaser diff --git a/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml index ab18bd5..b3d695b 100644 --- a/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml +++ b/core/modules/forum/config/install/core.entity_view_display.taxonomy_term.forums.default.yml @@ -6,7 +6,6 @@ dependencies: module: - text id: taxonomy_term.forums.default -label: null targetEntityType: taxonomy_term bundle: forums mode: default diff --git a/core/modules/node/node.module b/core/modules/node/node.module index c14fb14..124a060 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -100,13 +100,13 @@ function node_help($route_name, RouteMatchInterface $route_match) { case 'node.type_add': return '

' . t('Individual content types can have different fields, behaviors, and permissions assigned to them.') . '

'; - case "entity.node.field_ui_form_display": - case 'field_ui.form_display_overview_form_mode_node': + case 'entity.entity_form_display.node.default': + case 'entity.entity_form_display.node.form_mode': $type = $route_match->getParameter('node_type'); return '

' . t('Content items can be edited using different form modes. Here, you can define which fields are shown and hidden when %type content is edited in each form mode, and define how the field form widgets are displayed in each form mode.', array('%type' => $type->label())) . '

' ; - case 'entity.node.field_ui_display': - case 'field_ui.display_overview_view_mode_node': + case 'entity.entity_view_display.node.default': + case 'entity.entity_view_display.node.view_mode': $type = $route_match->getParameter('node_type'); return '

' . t('Content items can be displayed using different view modes: Teaser, Full content, Print, RSS, etc. Teaser is a short format that is typically used in lists of multiple content items. Full content is typically used when the content is displayed on its own page.') . '

' . '

' . t('Here, you can define which fields are shown and hidden when %type content is displayed in each view mode, and define how the fields are displayed in each view mode.', array('%type' => $type->label())) . '

'; diff --git a/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.default.yml b/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.default.yml index 7128ee4..c107b10 100644 --- a/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.default.yml +++ b/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.default.yml @@ -8,7 +8,6 @@ dependencies: - text - user id: node.options_install_test.default -label: null targetEntityType: node bundle: options_install_test mode: default diff --git a/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.teaser.yml b/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.teaser.yml index fe1e460..3b472a7 100644 --- a/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.teaser.yml +++ b/core/modules/options/tests/options_config_install_test/config/install/core.entity_view_display.node.options_install_test.teaser.yml @@ -9,7 +9,6 @@ dependencies: - text - user id: node.options_install_test.teaser -label: null targetEntityType: node bundle: options_install_test mode: teaser diff --git a/core/modules/user/user.module b/core/modules/user/user.module index ebd4ced..86a88e8 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -78,10 +78,10 @@ function user_help($route_name, RouteMatchInterface $route_match) { case 'entity.user.field_ui_fields': return '

' . t('This form lets administrators add and edit fields for storing user data.') . '

'; - case 'entity.user.field_ui_form_display': + case 'entity.entity_form_display.user.default': return '

' . t('This form lets administrators configure how form fields should be displayed when editing a user profile.') . '

'; - case 'entity.node.field_ui_display': + case 'entity.entity_view_display.user.default': return '

' . t('This form lets administrators configure how fields should be displayed when rendering a user profile page.') . '

'; } } diff --git a/core/profiles/standard/config/install/core.entity_view_display.block_content.basic.default.yml b/core/profiles/standard/config/install/core.entity_view_display.block_content.basic.default.yml index 0b4a35b..f9ee027 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.block_content.basic.default.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.block_content.basic.default.yml @@ -7,7 +7,6 @@ dependencies: module: - text id: block_content.basic.default -label: null targetEntityType: block_content bundle: basic mode: default diff --git a/core/profiles/standard/config/install/core.entity_view_display.comment.comment.default.yml b/core/profiles/standard/config/install/core.entity_view_display.comment.comment.default.yml index 83f69ce..0489d23 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.comment.comment.default.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.comment.comment.default.yml @@ -7,7 +7,6 @@ dependencies: module: - text id: comment.comment.default -label: null targetEntityType: comment bundle: comment mode: default diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml b/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml index 11a80d8..d8e8ad0 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml @@ -14,7 +14,6 @@ dependencies: - text - user id: node.article.default -label: null targetEntityType: node bundle: article mode: default diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.article.rss.yml b/core/profiles/standard/config/install/core.entity_view_display.node.article.rss.yml index e5f2a49..4308faf 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.node.article.rss.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.node.article.rss.yml @@ -11,7 +11,6 @@ dependencies: module: - user id: node.article.rss -label: null targetEntityType: node bundle: article mode: rss diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml b/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml index f6e4f63..aa28ff0 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml @@ -14,7 +14,6 @@ dependencies: - text - user id: node.article.teaser -label: null targetEntityType: node bundle: article mode: teaser diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.page.default.yml b/core/profiles/standard/config/install/core.entity_view_display.node.page.default.yml index 1ae1bd7..d331484 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.node.page.default.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.node.page.default.yml @@ -8,7 +8,6 @@ dependencies: - text - user id: node.page.default -label: null targetEntityType: node bundle: page mode: default diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.page.teaser.yml b/core/profiles/standard/config/install/core.entity_view_display.node.page.teaser.yml index 4f60c3c..3d4d9ed 100644 --- a/core/profiles/standard/config/install/core.entity_view_display.node.page.teaser.yml +++ b/core/profiles/standard/config/install/core.entity_view_display.node.page.teaser.yml @@ -9,7 +9,6 @@ dependencies: - text - user id: node.page.teaser -label: null targetEntityType: node bundle: page mode: teaser