You are here

function language_entity_base_field_info_alter in Drupal 9

Same name and namespace in other branches
  1. 8 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 167
Add language handling functionality to Drupal.

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