diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php index 0d68e77..94e115f 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php @@ -38,6 +38,17 @@ public function getFormId() { /** * {@inheritdoc} */ + public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { + if ($this->getRequest()->attributes->has('view_mode_name')) { + $this->mode = $this->getRequest()->attributes->get('view_mode_name'); + } + + parent::buildForm($form, $form_state, $entity_type, $bundle); + } + + /** + * {@inheritdoc} + */ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, EntityDisplayBaseInterface $entity_display, array $form, array &$form_state) { $field_row = parent::buildFieldRow($field_id, $instance, $entity_display, $form, $form_state); $display_options = $entity_display->getComponent($field_id); 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 9834005..06a4bdc 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -82,17 +82,10 @@ public function getRegions() { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL, $mode = NULL) { + public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { parent::buildForm($form, $form_state, $entity_type, $bundle); - $raw_variables = $this->getRequest()->attributes->get('_raw_variables')->all(); - if (isset($raw_variables['form_mode_name'])) { - $this->mode = $raw_variables['form_mode_name']; - } - elseif (isset($raw_variables['view_mode_name'])) { - $this->mode = $raw_variables['view_mode_name']; - } - else { + if (empty($this->mode)) { $this->mode = 'default'; } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php index a1e8d8b..19cf261 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php @@ -38,6 +38,17 @@ public function getFormId() { /** * {@inheritdoc} */ + public function buildForm(array $form, array &$form_state, $entity_type = NULL, $bundle = NULL) { + if ($this->getRequest()->attributes->has('form_mode_name')) { + $this->mode = $this->getRequest()->attributes->get('form_mode_name'); + } + + parent::buildForm($form, $form_state, $entity_type, $bundle); + } + + /** + * {@inheritdoc} + */ protected function buildFieldRow($field_id, FieldInstanceInterface $instance, EntityDisplayBaseInterface $entity_display, array $form, array &$form_state) { $field_row = parent::buildFieldRow($field_id, $instance, $entity_display, $form, $form_state); diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php index 3e15548..a75a495 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Plugin/Derivative/FieldUiLocalTask.php @@ -173,6 +173,9 @@ public function getDerivativeDefinitions(array $base_plugin_definition) { /** * Alters the tab_root_id definition for field_ui local tasks. + * + * @param array $local_tasks + * An array of local tasks plugin definitions, keyed by plugin ID. */ public function alterLocalTasks(&$local_tasks) { foreach ($this->entityManager->getDefinitions() as $entity_type => $entity_info) {