Problem/Motivation
After upgrading to Drupal 11 saving a view with a duplicate link displays an warning message.
The warning is also displayed when running the database update "views_post_update_table_css_class" after a fresh D11 upgrade.
[notice] Update started: views_post_update_table_css_class
[warning] Schema errors for views.view.my_view_name with the following errors: views.view.my_view_name:display.page_1.display_options.fields.clone_link.text missing schema. These errors mean there is configuration that does not comply with its schema. This is not a fatal error, but it is recommended to fix these issues. For more information on configuration schemas, check out <a href="https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata">the documentation</a>.
Steps to reproduce
- Upgrade Drupal 11
- Run
drush updb - Create a view
- Add the field "Add clone link"
- Save the view
Proposed resolution
Add a schema for the field to "quick_node_clone/config/schema/quick_node_clone.schema.yml"
views.field.quick_node_clone_link:
type: views_field
label: 'Quick Node Clone link'
mapping:
text:
type: label
label: 'Text to display'
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3613227 after.png | 234 KB | csakiistvan |
| #4 | 3613227 before.png | 254.43 KB | csakiistvan |
| #2 | quick-node-clone-views-fieldschema-errors-drupal11-3613227-2.patch | 536 bytes | electric.larry |
Comments
Comment #2
electric.larry commentedI created a patch that adds the missing schema for the views field.
It adds the following code to
quick_node_clone/config/schema/quick_node_clone.schema.ymlComment #3
csakiistvanComment #4
csakiistvanEnvironment
Prerequisites
quick_node_cloneandviews_ui.web/sites/default/services.ymland rebuild caches:qnc_test).Steps
views.field.quick_node_clone_linkschema definition toconfig/schema/quick_node_clone.schema.yml.ddev drush cr/admin/structure/views/view/qnc_test.Expected results
missing schemareport fordisplay.*.display_options.fields.clone_link.text.ddev drush updbproduces no schema warning for views containing the clone link field.Actual results
Before the fix, saving the view aborted with
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for views.view.qnc_test with the following errors: views.view.qnc_test:display.default.display_options.fields.clone_link.text missing schema, matching the warning reported duringviews_post_update_table_css_class. After adding theviews.field.quick_node_clone_linkschema and rebuilding caches, the same view saves cleanly and a programmatic schema check onviews.view.qnc_testreturns no errors.Testing produced with the assistance of an LLM.