Issue #2387627 by olli: Changing access plugins in views leaves invalid settings around
parent
000f3924f3
commit
2c214a7559
|
@ -56,6 +56,14 @@ class AccessRoleUITest extends UITestBase {
|
|||
|
||||
$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 @@ abstract class DisplayPluginBase extends PluginBase {
|
|||
$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 @@ abstract class DisplayPluginBase extends PluginBase {
|
|||
'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');
|
||||
|
|
Loading…
Reference in New Issue