function LanguageHooks::entityBaseFieldInfoAlter

Implements hook_entity_base_field_info_alter().

File

core/modules/language/src/Hook/LanguageHooks.php, line 192

Class

LanguageHooks
Hook implementations for language.

Namespace

Drupal\language\Hook

Code

public function entityBaseFieldInfoAlter(&$fields) : void {
    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.