Problem/Motivation
The widget with ID daterange_default
is defined in \Drupal\datetime_range\Plugin\Field\FieldWidget\DateRangeDefaultWidget
. Its grandparent class (i.e.: parent class' parent class), \Drupal\datetime\Plugin\Field\FieldWidget\DateTimeWidgetBase
gets/sets a date_increment
setting, which gets exported to core.entity_form_display.*
configurations.
However, this date_increment
setting is not defined in the widget's field.widget.settings.[widget_name]
config schema definition β
. See
the change record for Configuration schema for field settings, default values and entity view/form displays changed in 8.0.0 β
for more information.
Steps to reproduce
Try to install a module that defines a field of type daterange
with a widget of type daterange_default
inside a test environment (I happen to be using drupal-8.9.6 at the time-of-writing but the config definition is missing in 9.0.x and 9.1.x): you will see an error like:
1) Drupal\Tests\example\Functional\ExampleTest::testExample
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for core.entity_form_display.node.example.default with the following errors: core.entity_form_display.node.example.default:content.field_example.settings.date_increment missing schema
web/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php:95
web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111
web/core/lib/Drupal/Core/Config/Config.php:231
web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:284
web/core/lib/Drupal/Core/Entity/EntityStorageBase.php:457
web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:263
web/core/lib/Drupal/Core/Entity/EntityBase.php:395
web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:616
web/core/lib/Drupal/Core/Config/ConfigInstaller.php:371
web/core/lib/Drupal/Core/Config/ConfigInstaller.php:137
web/core/lib/Drupal/Core/ProxyClass/Config/ConfigInstaller.php:75
web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:287
web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83
web/core/includes/install.core.inc:1649
web/core/includes/install.core.inc:695
web/core/includes/install.core.inc:570
web/core/includes/install.core.inc:118
web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:296
web/core/tests/Drupal/Tests/BrowserTestBase.php:573
web/core/tests/Drupal/Tests/BrowserTestBase.php:406
web/modules/custom/example/tests/src/Functional/ExampleTest.php:41
Proposed resolution
Update the configuration schema for field.widget.settings.daterange_default
in core/modules/datetime_range/config/schema/datetime_range.schema.yml
to look like:
field.widget.settings.daterange_default:
type: mapping
label: 'Date range default display format settings'
mapping:
date_increment:
type: integer
label: 'Date Increment'
(this is similar to the definition for field.widget.settings.datetime_default
in core/modules/datetime/config/schema/datetime.schema.yml
)
Remaining tasks
- Review and feedback
- RTBC and feedback
- Commit to 9.1.x
- Backport to 9.0.x
- Backport to 8.9.x
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
I daresay this problem isn't exciting enough to warrant a release notes snippet, but just in case,
Added missing date_increment config schema to daterange_default widget.
Documentation links
-
Documentation -> Drupal -> Drupal APIs -> Configuration API -> Configuration schema/metadata β
-
Drupal core Change records -> Configuration schema for field settings, default values and entity view/form displays changed β