You are here

function tmgmt_modules_installed in Translation Management Tool 8

Same name and namespace in other branches
  1. 7 tmgmt.module \tmgmt_modules_installed()

Implements hook_modules_installed().

File

./tmgmt.module, line 59
Main module file for the Translation Management module.

Code

function tmgmt_modules_installed($modules) {
  $translator_manager = \Drupal::service('plugin.manager.tmgmt.translator');
  $translator_manager
    ->clearCachedDefinitions();
  foreach ($translator_manager
    ->getDefinitions() as $definition) {

    // Check if this translator plugin has been added by one of the recently
    // installed modules and doesn't prevent auto creation.
    if ((!isset($definition['auto create']) || $definition['auto create'] == TRUE) && in_array($definition['provider'], $modules)) {
      tmgmt_translator_auto_create($definition);
    }
  }
}