function DrupalKernel::moduleData

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::moduleData()
  2. 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::moduleData()
  3. 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::moduleData()

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.

2 calls to DrupalKernel::moduleData()
DrupalKernel::getModuleFileNames in core/lib/Drupal/Core/DrupalKernel.php
Gets the file name for each enabled module.
DrupalKernel::getModulesParameter in core/lib/Drupal/Core/DrupalKernel.php
Returns an array of Extension class parameters for all enabled modules.

File

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

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([]);
        $all_profiles = $listing->scan('profile');
        $profiles = array_intersect_key($all_profiles, $this->moduleList);
        $profile_directories = array_map(function (Extension $profile) {
            return $profile->getPath();
        }, $profiles);
        $listing->setProfileDirectories($profile_directories);
        // Now find modules.
        $this->moduleData = $profiles + $listing->scan('module');
    }
    return $this->moduleData[$module] ?? FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.