Problem/Motivation
Steps to reproduce: Install, create a new view, change access setting to "Role" and check anonymous, change access setting to "None", and try to save the view. You get an error:
InvalidArgumentException: The configuration property display.default.display_options.access.options.role.anonymous doesn't exist. in Drupal\Core\Config\Schema\Mapping->get() (line 66 of Drupal/Core/Config/Schema/Mapping.php).
When editing the view, views ui copies plugin setting from the previously selected plugin to the new one preserving previously entered values for common configuration options. These options may contain values that are not defined in the new plugin so at some point we need to remove any cruft from the options.
Proposed resolution
Remove cruft when changing the plugin
Remaining tasks
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | 2387627-15.patch | 2.31 KB | olli |
Comments
Comment #1
olli commentedHere's a test.
Comment #2
olli commentedComment #3
olli commentedCan we clean up in validate()?
Comment #6
olli commentedIn #3:
Currently we call validate() only for style and query and this would call it for every plugin. Is this something we should do anyway and open separate issue?
I think the second patch in #2 is the smallest change but not sure if it is ok to call unpackoptions before init.
Any other ideas?
Comment #7
dawehnerCan we document what we intend to do here? On top of that it feels wrong to do that in validate to be honest ...
Comment #8
dawehnerCan we expand the test coverage to ensure that the old options aren't there anymore?
+1 to validate all plugins
Comment #9
gábor hojtsyComment #10
olli commentedThanks for the reviews.
#7: That was an attempt to do something like filterByDefinedOptions, removed.
#8.1: Fixed.
#8.2: Great.
This patch removes cruft in submit like #2 but borrows filterByDefinedOptions() from #2387157: Cloning display into another display also stores options that are not supported by the new display type.
Comment #11
olli commentedPostponing on #2387157: Cloning display into another display also stores options that are not supported by the new display type.
Comment #12
dawehnerI really like this change!
Comment #13
gábor hojtsy#2387157: Cloning display into another display also stores options that are not supported by the new display type landed.
Comment #14
dawehner.
Comment #15
olli commentedReroll. I'll open another issue to validate all plugins.
Comment #16
dawehnerAlright, thank you!
Comment #17
olli commentedHere's the issue #2392633: [META] Allow all views plugins to validate.
Comment #20
olli commentedComment #21
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 2c214a7 and pushed to 8.0.x. Thanks!