diff --git a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php index 9c96920..f50b213 100644 --- a/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php +++ b/core/modules/rest/lib/Drupal/rest/Tests/Views/StyleSerializerTest.php @@ -140,7 +140,7 @@ public function testUIFieldAlias() { // Test the UI settings for adding field ID aliases. $this->drupalGet('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1'); - $row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options'; + $row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row'; $this->assertLinkByHref($row_options); // Test an empty string for an alias, this should not be used. This also @@ -207,7 +207,7 @@ public function testFieldRawOutput() { // Test the UI settings for adding field ID aliases. $this->drupalGet('admin/structure/views/view/test_serializer_display_field/edit/rest_export_1'); - $row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options'; + $row_options = 'admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row'; $this->assertLinkByHref($row_options); // Test an empty string for an alias, this should not be used. This also diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index d527836..3fa8c41 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -1108,11 +1108,6 @@ public function optionsSummary(&$categories, &$options) { 'desc' => t('Change the way content is formatted.'), ); - // This adds a 'Settings' link to the style_options setting if the style has options. - if ($style_plugin_instance->usesOptions()) { - $options['style']['links']['style_options'] = t('Change settings for this format'); - } - if ($style_plugin_instance->usesRowPlugin()) { $row_plugin_instance = $this->getPlugin('row'); $row_summary = empty($row_plugin_instance->definition['title']) ? t('Missing style plugin') : $row_plugin_instance->summaryTitle(); @@ -1125,10 +1120,6 @@ public function optionsSummary(&$categories, &$options) { 'setting' => $row_summary, 'desc' => t('Change the way each row in the view is styled.'), ); - // This adds a 'Settings' link to the row_options setting if the row style has options. - if ($row_plugin_instance->usesOptions()) { - $options['row']['links']['row_options'] = t('Change settings for this style'); - } } if ($this->usesAJAX()) { $options['use_ajax'] = array( @@ -1603,59 +1594,48 @@ public function buildOptionsForm(&$form, &$form_state) { $form['#title'] .= t('How should this view be styled'); $style_plugin = $this->getPlugin('style'); $form['style'] = array( + '#title' => t('Select the format'), '#type' => 'radios', '#options' => views_fetch_plugin_names('style', $this->getType(), array($this->view->storage->get('base_table'))), '#default_value' => $style_plugin->definition['id'], '#description' => t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), ); - if ($style_plugin->usesOptions()) { - $form['markup'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected style.', array('!settings' => $this->optionLink(t('settings'), 'style_options'))), - ); - } - - break; - case 'style_options': - $form['#title'] .= t('Style options'); - $style = TRUE; $style_plugin = $this->getOption('style'); $name = $style_plugin['type']; - case 'row_options': - if (!isset($name)) { - $row_plugin = $this->getOption('row'); - $name = $row_plugin['type']; - } - // if row, $style will be empty. - if (empty($style)) { - $form['#title'] .= t('Row style options'); - } - $plugin = $this->getPlugin(empty($style) ? 'row' : 'style', $name); + $plugin = $this->getPlugin('style', $name); if ($plugin) { - $form[$form_state['section']] = array( + $form['style_options'] = array( + '#type' => 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => FALSE, + '#title' => t('Options'), '#tree' => TRUE, ); - $plugin->buildOptionsForm($form[$form_state['section']], $form_state); + $plugin->buildOptionsForm($form['style_options'], $form_state); } break; case 'row': $form['#title'] .= t('How should each row in this view be styled'); $row_plugin_instance = $this->getPlugin('row'); $form['row'] = array( + '#title' => t('Select the row format'), '#type' => 'radios', '#options' => views_fetch_plugin_names('row', $this->getType(), array($this->view->storage->get('base_table'))), '#default_value' => $row_plugin_instance->definition['id'], ); - if ($row_plugin_instance->usesOptions()) { - $form['markup'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => t('You may also adjust the !settings for the currently selected row style.', array('!settings' => $this->optionLink(t('settings'), 'row_options'))), + $plugin = $this->getPlugin('row'); + if ($plugin) { + $form['row_options'] = array( + '#type' => 'fieldset', + '#collapsed' => FALSE, + '#collapsible' => FALSE, + '#title' => t('Options'), + '#tree' => TRUE, ); + $plugin->buildOptionsForm($form['row_options'], $form_state); } break; @@ -2251,10 +2231,18 @@ public function submitOptionsForm(&$form, &$form_state) { // send ajax form to options page if we use it. if ($plugin->usesOptions()) { - $form_state['view']->addFormToStack('display', $this->display['id'], 'row_options'); + $form_state['view']->addFormToStack('display', $this->display['id'], 'row'); } } } + + $plugin = $this->getPlugin('row'); + if ($plugin) { + $row = $this->getOption('row'); + $plugin->submitOptionsForm($form['row_options'], $form_state); + $row['options'] = $form_state['values']['row_options']; + $this->setOption('row', $row); + } break; case 'style': // This if prevents resetting options to default if they don't change @@ -2267,29 +2255,18 @@ public function submitOptionsForm(&$form, &$form_state) { $this->setOption($section, $row); // send ajax form to options page if we use it. if ($plugin->usesOptions()) { - $form_state['view']->addFormToStack('display', $this->display['id'], 'style_options'); + $form_state['view']->addFormToStack('display', $this->display['id'], 'style'); } } } - break; - case 'style_options': $plugin = $this->getPlugin('style'); if ($plugin) { $style = $this->getOption('style'); $plugin->submitOptionsForm($form['style_options'], $form_state); - $style['options'] = $form_state['values'][$section]; + $style['options'] = $form_state['values']['style_options']; $this->setOption('style', $style); } break; - case 'row_options': - $plugin = $this->getPlugin('row'); - if ($plugin) { - $row = $this->getOption('row'); - $plugin->submitOptionsForm($form['row_options'], $form_state); - $row['options'] = $form_state['values'][$section]; - $this->setOption('row', $row); - } - break; case 'exposed_block': $this->setOption($section, (bool) $form_state['values'][$section]); break; diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php index e522e8f..f1ebbe9 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/RowUITest.php @@ -38,7 +38,6 @@ public function testRowUI() { $view_edit_url = "admin/structure/views/view/$view_name/edit"; $row_plugin_url = "admin/structure/views/nojs/display/$view_name/default/row"; - $row_options_url = "admin/structure/views/nojs/display/$view_name/default/row_options"; $this->drupalGet($row_plugin_url); $this->assertFieldByName('row', 'fields', 'The default row plugin selected in the UI should be fields.'); @@ -53,7 +52,7 @@ public function testRowUI() { 'row_options[test_option]' => $random_name ); $this->drupalPost(NULL, $edit, t('Apply')); - $this->drupalGet($row_options_url); + $this->drupalGet($row_plugin_url); $this->assertFieldByName('row_options[test_option]', $random_name, 'Make sure the custom settings form field has the expected value stored.'); $this->drupalPost($view_edit_url, array(), t('Save')); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php index 5666547..c4a871d 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/Tests/StyleUITest.php @@ -38,7 +38,6 @@ public function testStyleUI() { $view_edit_url = "admin/structure/views/view/$view_name/edit"; $style_plugin_url = "admin/structure/views/nojs/display/$view_name/default/style"; - $style_options_url = "admin/structure/views/nojs/display/$view_name/default/style_options"; $this->drupalGet($style_plugin_url); $this->assertFieldByName('style', 'default', 'The default style plugin selected in the UI should be unformatted list.'); @@ -53,7 +52,7 @@ public function testStyleUI() { 'style_options[test_option]' => $random_name ); $this->drupalPost(NULL, $edit, t('Apply')); - $this->drupalGet($style_options_url); + $this->drupalGet($style_plugin_url); $this->assertFieldByName('style_options[test_option]', $random_name, 'Make sure the custom settings form field has the expected value stored.'); $this->drupalPost($view_edit_url, array(), t('Save'));