diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index 292a2e3..dfe6cf4 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -246,7 +246,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $style_form['style_plugin']['#default_value'] = static::getSelected($form_state, array('page', 'style', 'style_plugin'), 'default', $style_form['style_plugin']); // Changing this dropdown updates $form['displays']['page']['options'] via // AJAX. - views_ui_add_ajax_trigger($style_form, 'style_plugin', array('displays', 'page', 'options')); + views_ui_add_ajax_trigger($style_form, 'style_plugin', array('wizard__' . $this->getPluginId(), 'displays', 'page', 'options')); $this->buildFormStyle($form, $form_state, 'page'); $form['displays']['page']['options']['items_per_page'] = array( @@ -387,7 +387,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $style_form['style_plugin']['#default_value'] = static::getSelected($form_state, array('block', 'style', 'style_plugin'), 'default', $style_form['style_plugin']); // Changing this dropdown updates $form['displays']['block']['options'] // via AJAX. - views_ui_add_ajax_trigger($style_form, 'style_plugin', array('displays', 'block', 'options')); + views_ui_add_ajax_trigger($style_form, 'style_plugin', array('wizard__' . $this->getPluginId(), 'displays', 'block', 'options')); $this->buildFormStyle($form, $form_state, 'block'); $form['displays']['block']['options']['items_per_page'] = array( @@ -554,7 +554,7 @@ protected function buildFormStyle(array &$form, FormStateInterface $form_state, $default_value = $block_with_linked_titles_available ? 'titles_linked' : key($options); $style_form['row_plugin']['#default_value'] = static::getSelected($form_state, array($type, 'style', 'row_plugin'), $default_value, $style_form['row_plugin']); // Changing this dropdown updates the individual row options via AJAX. - views_ui_add_ajax_trigger($style_form, 'row_plugin', array('displays', $type, 'options', 'style', 'row_options')); + views_ui_add_ajax_trigger($style_form, 'row_plugin', array('wizard__' . $this->getPluginId(), 'displays', $type, 'options', 'style', 'row_options')); // This is the region that can be updated by AJAX. The base class doesn't // add anything here, but child classes can. @@ -606,7 +606,7 @@ protected function buildFilters(&$form, FormStateInterface $form_state) { // Changing this dropdown updates the entire content of $form['displays'] // via AJAX, since each bundle might have entirely different fields // attached to it, etc. - views_ui_add_ajax_trigger($form['displays']['show'], 'type', array('displays')); + views_ui_add_ajax_trigger($form['displays']['show'], 'type', array('wizard__' . $this->getPluginId(), 'displays')); } } diff --git a/core/modules/views_ui/src/ViewAddForm.php b/core/modules/views_ui/src/ViewAddForm.php index 9750094..f6a1db9 100644 --- a/core/modules/views_ui/src/ViewAddForm.php +++ b/core/modules/views_ui/src/ViewAddForm.php @@ -111,7 +111,6 @@ public function form(array $form, FormStateInterface $form_state) { $form['displays']['show'] = array( '#type' => 'fieldset', '#title' => t('View settings'), - '#tree' => TRUE, '#attributes' => array('class' => array('container-inline')), ); @@ -130,14 +129,20 @@ public function form(array $form, FormStateInterface $form_state) { $show_form = &$form['displays']['show']; $default_value = \Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'users'; $show_form['wizard_key']['#default_value'] = WizardPluginBase::getSelected($form_state, array('show', 'wizard_key'), $default_value, $show_form['wizard_key']); - // Changing this dropdown updates the entire content of $form['displays'] via - // AJAX. - views_ui_add_ajax_trigger($show_form, 'wizard_key', array('displays')); // Build the rest of the form based on the currently selected wizard plugin. $wizard_key = $show_form['wizard_key']['#default_value']; + + // Changing this dropdown updates the entire content of $form['displays'] via + // AJAX. + views_ui_add_ajax_trigger($show_form, 'wizard_key', array('wizard__' . $wizard_key, 'displays')); + + /** @var \Drupal\views\Plugin\views\wizard\WizardPluginBase $wizard_instance */ $wizard_instance = $this->wizardManager->createInstance($wizard_key); - $form = $wizard_instance->buildForm($form, $form_state); + $subform = $wizard_instance->buildForm($form, $form_state); + + $form['wizard__' . $wizard_key] = $subform; + $form['wizard__' . $wizard_key]['#tree'] = TRUE; return $form; }