/** * Overrides Drupal\configuration\Config\Configuration::alterDependencies(). */ public static function alterDependencies(Configuration $config) { if ($config->getComponent() == 'content_type') { $variables = array('field_bundle_settings_node_', 'language_content_type', 'node_options', 'node_preview', 'node_submitted'); if (module_exists('comment')) { $variables += array('comment', 'comment_anonymous', 'comment_controls', 'comment_default_mode', 'comment_default_order', 'comment_default_per_page', 'comment_form_location', 'comment_preview', 'comment_subject_field'); } if (module_exists('menu')) { $variables += array('menu_options', 'menu_parent'); } $entity_type = $config->getEntityType(); $fields = field_info_instances($entity_type, $config->getIdentifier()); foreach ($variables as $variable) { $identifier = $variable . '_' . $config->getIdentifier(); $in_db = db_query("SELECT 1 FROM {variable} WHERE name = :name", array(':name' => $identifier))->fetchField(); // Some variables are not in the database and their values are // provided by the second paramenter of variable_get. // Only inform about configurations that are indeed in the database. if ($in_db) { $var_config = new VariableConfiguration($identifier); $var_config->build(); $config->addToDependencies($var_config); } } } }
/** * Overrides Drupal\configuration\Config\Configuration::alterDependencies(). */ public static function alterDependencies(Configuration $config) { if ($config->configForEntity()) { $entity_type = $config->getEntityType(); if (empty($entity_type)) { return; } $fields = field_info_instances($entity_type, $config->getIdentifier()); foreach ($fields as $name => $field) { $identifier = $entity_type . "." . $field['field_name'] . "." . $field['bundle']; // Avoid include multiple times the same dependency. if (empty($stack['field.' . $identifier])) { $field = new FieldConfiguration($identifier); $field->build(); $field->addToDependencies($config); $config->addToOptionalConfigurations($field); $stack['field.' . $identifier] = TRUE; } } } }