public function VariableConfigurationHandler::onContentTypeLoad in Configuration Management 7.3
Reacts when a content type is loaded and add some variables as dependencies of the loaded content type.
Parameters
ConfigurationCRUDEvent $event: The event triggered when loading the content type from the database.
File
- src/
Handlers/ VariableConfigurationHandler.php, line 60
Class
Namespace
Configuration\HandlersCode
public function onContentTypeLoad($event) {
$type = $this
->getInternalId($event->configuration
->getIdentifier());
$variables = array(
'field_bundle_settings_node_',
'language_content_type',
'node_options',
'node_preview',
'node_submitted',
);
if ($this->configuration_manager
->drupal()
->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 ($this->configuration_manager
->drupal()
->module_exists('menu')) {
$variables += array(
'menu_options',
'menu_parent',
);
}
foreach ($variables as &$variable) {
$variable .= '_' . $type;
}
// Some variables doesn't have a valude defined in the database and its
// values are provided by the second parameter of variable_get.
// Only inform about variables that are actually have values.
global $conf;
foreach ($variables as $variable_name) {
if (isset($conf[$variable_name])) {
$this->configuration_manager
->newDependency($event->configuration, 'variable.' . $variable_name);
}
}
}