function language_entity_base_field_info_alter

Same name and namespace in other branches
  1. 9 core/modules/language/language.module \language_entity_base_field_info_alter()
  2. 8.9.x core/modules/language/language.module \language_entity_base_field_info_alter()

Implements hook_entity_base_field_info_alter().

File

core/modules/language/language.module, line 170

Code

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);
        }
      }
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.