Ejemplo n.º 1
0
 /**
  * Helper function to update dependencies array for a specific config item
  * @param \Drupal\features\ConfigurationItem $config a config item
  * @param array $module_list
  * @return array $dependencies
  */
 protected function getConfigDependency(ConfigurationItem $config, $module_list = array())
 {
     $dependencies = [];
     $type = $config->getType();
     if ($type != FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG) {
         $provider = $this->entityManager->getDefinition($type)->getProvider();
         // Ensure the provider is an installed module and not, for example, 'core'
         if (isset($module_list[$provider])) {
             $dependencies[] = $provider;
         }
         // For configuration in the InstallStorage::CONFIG_INSTALL_DIRECTORY
         // directory, set any module dependencies of the configuration item
         // as package dependencies.
         // As its name implies, the core-provided
         // InstallStorage::CONFIG_OPTIONAL_DIRECTORY should not create
         // dependencies.
         if ($config->getSubdirectory() === InstallStorage::CONFIG_INSTALL_DIRECTORY && isset($config->getData()['dependencies']['module'])) {
             $dependencies = array_merge($dependencies, $config->getData()['dependencies']['module']);
         }
     }
     return $dependencies;
 }