public function FeaturesManager::loadPackage in Features 8.3
Same name and namespace in other branches
- 8.4 src/FeaturesManager.php \Drupal\features\FeaturesManager::loadPackage()
Load a specific package.
Similar to getPackage but can also load modules that are not Features.
Parameters
string $module_name: Full machine name of module.
bool $any: If TRUE then check for any module, not just a Features module.
Return value
\Drupal\features\Package Package data.
Overrides FeaturesManagerInterface::loadPackage
1 call to FeaturesManager::loadPackage()
- FeaturesManager::import in src/
FeaturesManager.php - The import function.
File
- src/
FeaturesManager.php, line 314
Class
- FeaturesManager
- The FeaturesManager provides helper functions for building packages.
Namespace
Drupal\featuresCode
public function loadPackage($module_name, $any = FALSE) {
$package = $this
->getPackage($module_name);
// Load directly from module if packages are not loaded or
// if we want to include ANY module regardless of its a feature.
if ((empty($this->packages) || $any) && !isset($package)) {
$module_list = $this->moduleHandler
->getModuleList();
if (!empty($module_list[$module_name])) {
$extension = $module_list[$module_name];
$package = $this
->initPackageFromExtension($extension);
$config = $this
->listExtensionConfig($extension);
$package
->setConfigOrig($config);
$package
->setStatus(FeaturesManagerInterface::STATUS_INSTALLED);
}
}
return $package;
}