You are here

function _potx_find_modules in Translation template extractor 7.3

Same name and namespace in other branches
  1. 8 potx.local.inc \_potx_find_modules()

Recursively find all modules in a given path, by looking for .info.yml files.

Parameters

string $path: The search path

1 call to _potx_find_modules()
_potx_find_all_modules in ./potx.local.inc
Find all available modules based on Drupal 8's directory structure.

File

./potx.local.inc, line 100

Code

function _potx_find_modules($path) {
  global $_potx_found_modules;
  $subdirs = glob($path . '/*', GLOB_ONLYDIR);
  if (is_array($subdirs)) {
    foreach ($subdirs as $dir) {
      if (!preg_match("!(^|.+/)(CVS|\\.svn|\\.git|tests|vendor)\$!", $dir)) {
        $module_name = basename($dir);
        $info_path = $dir . '/' . $module_name . '.info.yml';
        if (file_exists($info_path)) {
          $_potx_found_modules[$module_name]['path'] = $dir;
        }
        _potx_find_modules($dir);
      }
    }
  }
}