/** * Overrides Drupal\configuration\Config\Configuration::alterDependencies(). */ public static function alterDependencies(Configuration $config) { if ($config->getComponent() == 'content_type') { $permissions = node_list_permissions($config->getIdentifier()); foreach (array_keys($permissions) as $permission) { $identifier = str_replace(' ', '_', $permission); $perm = new PermissionConfiguration($identifier); $perm->build(); // Add the content type as a dependency of the permission. $perm->addToDependencies($config); // Add the permission as a child configuration of the content type // The permission is not required to load the content type but is // a nice to have. $config->addToOptionalConfigurations($perm); } } elseif ($config->getComponent() == 'text_format') { $format = $config->getData(); $permission = filter_permission_name($format); if (!empty($permission)) { $identifier = str_replace(' ', '_', $permission); $perm = new PermissionConfiguration($identifier); $perm->build(); // Add the text format as a dependency of the permission. $perm->addToDependencies($config); // Add the permission as a child configuration of the filter // The permission is not required to load the filter format but is // a nice to have. $config->addToOptionalConfigurations($perm); } } }