You are here

function config_actions_modules_installed in Config Actions 8

Implements hook_modules_installed().

Execute any config actions in the installed module.

Parameters

$modules:

1 call to config_actions_modules_installed()
ConfigActionsModuleTest::setUp in tests/src/Kernel/ConfigActionsModuleTest.php

File

./config_actions.module, line 16
Contains main module logic and hooks for config actions.

Code

function config_actions_modules_installed($modules) {
  if (\Drupal::isConfigSyncing()) {

    // Don't run config actions when enabling module during a config import.
    return;
  }
  foreach ($modules as $module_name) {
    $action_dir = DRUPAL_ROOT . '/' . drupal_get_path('module', $module_name) . '/' . ConfigActionsServiceInterface::CONFIG_ACTIONS_CONFIG_DIR;
    if (is_dir($action_dir)) {
      $configActions = \Drupal::service('config_actions');

      // Enable autoExecute mode to skip any actions marked with "auto:false"
      $configActions
        ->autoExecute(TRUE);
      $configActions
        ->importAction($module_name);
    }
  }
}