function language_modules_installed

language_modules_installed($modules)

Implements hook_modules_installed().

File

core/modules/language/language.module, line 312
Add language handling functionality to Drupal.

Code

function language_modules_installed($modules) {
  if (!in_array('language', $modules)) {
    // Since newly (un)installed modules may change the default settings for
    // non-locked language types (e.g. content language), we need to resave the
    // language type configuration.
    /** @var \Drupal\language\LanguageNegotiatorInterface $negotiator */
    $negotiator = \Drupal::service('language_negotiator');
    $configurable = \Drupal::config('language.types')->get('configurable');
    $negotiator->updateConfiguration($configurable);
    $negotiator->purgeConfiguration();
  }
  else {
    // In language_entity_base_field_info_alter() we are altering view/form
    // display definitions to make language fields display configurable. Since
    // this is not a hard dependency, and thus is not detected by the config
    // system, we have to clean up the related values manually.
    foreach (array('entity_view_display', 'entity_form_display') as $key) {
      $displays = \Drupal::entityManager()->getStorage($key)->loadMultiple();
      /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */
      foreach ($displays as $display) {
        $display->save();
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!language!language.module/function/language_modules_installed/8.1.x