Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
This dependency in SiteSettingEntity:
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language code'))
->setDescription(t('The language code for the Site Setting entity.'))
->setDisplayOptions('form', [
'type' => 'language_select',
'weight' => 10,
])
->setDisplayConfigurable('form', TRUE);
It leads to error if module 'language' is not installed. Like
Schema errors for core.entity_form_display.site_setting_entity.testsitesettingscreatenew.default with the following errors: core.entity_form_display.site_setting_entity.testsitesettingscreatenew.default:content.langcode.settings.include_locked missing schema
Proposed resolution
Looks like we can just remove setDisplayConfigurable('form', TRUE)
here. Because language module itself makes these settings for its fields via hook.
function language_entity_base_field_info_alter(&$fields) {
foreach ($fields as $definition) {
// Set configurable form display for language fields with display options.
if ($definition->getType() == 'language') {
foreach (['form', 'view'] as $type) {
if ($definition->getDisplayOptions($type)) {
// The related configurations will be purged manually on Language
// module uninstallation. @see language_modules_uninstalled().
$definition->setDisplayConfigurable($type, TRUE);
}
}
}
}
}
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | 2924674-2.patch | 557 bytes | Anonymous (not verified) |
#2 | 2924674-2-test-only.patch | 561 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #5
scott_euser CreditAttribution: scott_euser at Fat Beehive commentedThanks for your suggestions and work on this. I'll try to get to reviewing it in the upcoming weeks.
Comment #7
scott_euser CreditAttribution: scott_euser at Fat Beehive commentedCommitted, thank you!