You are here

public static function PanelizerConfiguration::alterDependencies in Configuration Management 7.2

Overrides Drupal\configuration\Config\Configuration::alterDependencies().

Overrides Configuration::alterDependencies

File

lib/Drupal/configuration/Config/PanelizerConfiguration.php, line 46
Definition of Drupal\configuration\Config\PanelizerConfiguration.

Class

PanelizerConfiguration

Namespace

Drupal\configuration\Config

Code

public static function alterDependencies(Configuration $config) {
  if ($config
    ->getComponent() == 'permission') {
    $panelizers = static::getAllIdentifiers('panelizer_defaults');
    $permission = $config
      ->getData();
    if (strpos($permission['permission'], 'administer panelizer ') === 0) {
      list(, , $entity_type, $bundle) = explode(' ', $permission['permission']);
      $id = $entity_type . ':' . $bundle;
      foreach ($panelizers as $panelizer_id) {
        if (strpos($panelizer_id, $id) === 0) {
          $panelizer = ConfigurationManagement::createConfigurationInstance('panelizer_defaults.' . $panelizer_id);
          $panelizer
            ->build();
          $config
            ->addToDependencies($panelizer);
        }
      }
    }
  }
}