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

CommentFileSizeAuthor
#2 2924674-2.patch557 bytesAnonymous (not verified)
#2 2924674-2-test-only.patch561 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

vaplas created an issue. See original summary.

Anonymous’s picture

FileSize
561 bytes
557 bytes
Anonymous’s picture

Status: Active » Needs review

The last submitted patch, 2: 2924674-2-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

scott_euser’s picture

Thanks for your suggestions and work on this. I'll try to get to reviewing it in the upcoming weeks.

  • scott_euser committed bcbc6df on 8.x-1.x authored by vaplas
    Issue #2924674 by vaplas: Schema errors due to implicit dependency from...
scott_euser’s picture

Status: Needs review » Fixed

Committed, thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.