W3cubDocs

/Drupal 8

protected function DrupalKernel::moduleData

protected DrupalKernel::moduleData($module)

Returns module data on the filesystem.

Parameters

$module: The name of the module.

Return value

\Drupal\Core\Extension\Extension|bool Returns an Extension object if the module is found, FALSE otherwise.

File

core/lib/Drupal/Core/DrupalKernel.php, line 700

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function moduleData($module) {
  if (!$this->moduleData) {
    // First, find profiles.
    $listing = new ExtensionDiscovery($this->root);
    $listing->setProfileDirectories(array());
    $all_profiles = $listing->scan('profile');
    $profiles = array_intersect_key($all_profiles, $this->moduleList);

    // If a module is within a profile directory but specifies another
    // profile for testing, it needs to be found in the parent profile.
    $settings = $this->getConfigStorage()->read('simpletest.settings');
    $parent_profile = !empty($settings['parent_profile']) ? $settings['parent_profile'] : NULL;
    if ($parent_profile && !isset($profiles[$parent_profile])) {
      // In case both profile directories contain the same extension, the
      // actual profile always has precedence.
      $profiles = array($parent_profile => $all_profiles[$parent_profile]) + $profiles;
    }

    $profile_directories = array_map(function($profile) {
      return $profile->getPath();
    }, $profiles);
    $listing->setProfileDirectories($profile_directories);

    // Now find modules.
    $this->moduleData = $profiles + $listing->scan('module');
  }
  return isset($this->moduleData[$module]) ? $this->moduleData[$module] : FALSE;
}

© 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!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::moduleData/8.1.x