diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index 397c07b..4ad0fb0 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -108,6 +108,8 @@ public static function create(ContainerInterface $container) { public function form(array $form, FormStateInterface $form_state) { $view = $this->entity; $display_id = $this->displayID; + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); // Do not allow the form to be cached, because $form_state->get('view') can become // stale between page requests. // See views_ui_ajax_get_form() for how this affects #ajax. @@ -205,8 +207,8 @@ public function form(array $form, FormStateInterface $form_state) { ); // Add a text that the display is disabled. - if ($this->executableFactory->get($view)->displayHandlers->has($display_id)) { - if (!$this->executableFactory->get($view)->displayHandlers->get($display_id)->isEnabled()) { + if ($executable->displayHandlers->has($display_id)) { + if (!$executable->displayHandlers->get($display_id)->isEnabled()) { $form['displays']['settings']['disabled']['#markup'] = $this->t('This display is disabled.'); } } @@ -222,7 +224,6 @@ public function form(array $form, FormStateInterface $form_state) { $tab_content['#attributes']['class'][] = 'views-display-deleted'; } // Mark disabled displays as such. - $executable = $this->executableFactory->get($view); if ($executable->displayHandlers->has($display_id) && !$executable->displayHandlers->get($display_id)->isEnabled()) { $tab_content['#attributes']['class'][] = 'views-display-disabled'; } @@ -375,7 +376,9 @@ public function cancel(array $form, FormStateInterface $form_state) { public function getDisplayTab($view) { $build = array(); $display_id = $this->displayID; - $display = $this->executableFactory->get($view)->displayHandlers->get($display_id); + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); + $display = $executable->displayHandlers->get($display_id); // If the plugin doesn't exist, display an error message instead of an edit // page. if (empty($display)) { @@ -406,12 +409,14 @@ public function getDisplayDetails($view, $display) { '#theme_wrappers' => array('container'), '#attributes' => array('id' => 'edit-display-settings-details'), ); + $executable = $this->executableFactory->get($view); + $executable->initDisplay(); $is_display_deleted = !empty($display['deleted']); // The master display cannot be duplicated. $is_default = $display['id'] == 'default'; // @todo: Figure out why getOption doesn't work here. - $is_enabled = $this->executableFactory->get($view)->displayHandlers->get($display['id'])->isEnabled(); + $is_enabled = $executable->displayHandlers->get($display['id'])->isEnabled(); if ($display['id'] != 'default') { $build['top']['#theme_wrappers'] = array('container'); @@ -440,8 +445,8 @@ public function getDisplayDetails($view, $display) { } // Add a link to view the page unless the view is disabled or has no // path. - elseif ($view->status() && $this->executableFactory->get($view)->displayHandlers->get($display['id'])->hasPath()) { - $path = $this->executableFactory->get($view)->displayHandlers->get($display['id'])->getPath(); + elseif ($view->status() && $executable->displayHandlers->get($display['id'])->hasPath()) { + $path = $executable->displayHandlers->get($display['id'])->getPath(); if ($path && (strpos($path, '%') === FALSE)) { $build['top']['actions']['path'] = array( '#type' => 'link', @@ -516,7 +521,7 @@ public function getDisplayDetails($view, $display) { $build['top']['display_title'] = array( '#theme' => 'views_ui_display_tab_setting', '#description' => $this->t('Display name'), - '#link' => $this->executableFactory->get($view)->displayHandlers->get($display['id'])->optionLink(SafeMarkup::checkPlain($display_title), 'display_title'), + '#link' => $executable->displayHandlers->get($display['id'])->optionLink(SafeMarkup::checkPlain($display_title), 'display_title'), ); } @@ -557,7 +562,7 @@ public function getDisplayDetails($view, $display) { // Fetch options from the display plugin, with a list of buckets they go into. $options = array(); - $this->executableFactory->get($view)->displayHandlers->get($display['id'])->optionsSummary($buckets, $options); + $executable->displayHandlers->get($display['id'])->optionsSummary($buckets, $options); // Place each option into its bucket. foreach ($options as $id => $option) { @@ -912,6 +917,7 @@ public function submitDuplicateDisplayAsType($form, FormStateInterface $form_sta */ public function buildOptionForm(ViewUI $view, $id, $option, $display) { $executable = $this->executableFactory->get($view); + $executable->initDisplay(); $option_build = array(); $option_build['#theme'] = 'views_ui_display_tab_setting';