Skip to content
Snippets Groups Projects
Commit 2c214a75 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2387627 by olli: Changing access plugins in views leaves invalid settings around

parent 000f3924
No related branches found
No related tags found
No related merge requests found
......@@ -56,6 +56,14 @@ public function testAccessRoleUI() {
$display = $view->getDisplay('default');
$this->assertEqual($display['display_options']['access']['options']['role'], array('custom_role' => 'custom_role'));
// Test changing access plugin from role to none.
$this->drupalPostForm('admin/structure/views/nojs/display/test_access_role/default/access', ['access[type]' => 'none'], t('Apply'));
$this->drupalPostForm(NULL, array(), t('Save'));
// Verify that role option is not set.
$view = $entity_manager->getStorage('view')->load('test_access_role');
$display = $view->getDisplay('default');
$this->assertFalse(isset($display['display_options']['access']['options']['role']));
}
}
......@@ -1994,6 +1994,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
$plugin_options = $this->getOption($plugin_type);
$type = $form_state->getValue(array($plugin_type, 'type'));
if ($plugin_options['type'] != $type) {
/** @var \Drupal\views\Plugin\views\ViewsPluginInterface $plugin */
$plugin = Views::pluginManager($plugin_type)->createInstance($type);
if ($plugin) {
$plugin->init($this->view, $this, $plugin_options['options']);
......@@ -2001,6 +2002,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
'type' => $type,
'options' => $plugin->options,
);
$plugin->filterByDefinedOptions($plugin_options['options']);
$this->setOption($plugin_type, $plugin_options);
if ($plugin->usesOptions()) {
$form_state->get('view')->addFormToStack('display', $this->display['id'], $plugin_type . '_options');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment