function commons_bw_system_info_alter in Drupal Commons 7.3
Implements hook_system_info_alter().
File
- modules/
commons/ commons_bw/ commons_bw.module, line 24
Code
function commons_bw_system_info_alter(&$info, $file, $type) {
// Commons BW dynamically adds the title_field field to content types that
// request it.
// We must add a corresponding line for each field instance to commons_bw.info
// so that Features is aware of the instance and can successfully revert the
// field_instance component back to its default state.
if ($file->name == 'commons_bw') {
foreach (node_type_get_types() as $node_type_object) {
$node_type = $node_type_object->type;
if (commons_bw_node_auto_title_instance($node_type)) {
$info['features']['field_instance'][] = "node-{$node_type}-title_field";
}
}
}
// Dynamically adding a field to a content type results in features
// automatically detecting Commons BW as a dependency.
// We manually exclude the dependency in order to prevent the content type
// modules from appearing overridden and to allow them to be used
// independently of Commons BW.
$node_types =& drupal_static(__FUNCTION__);
if (!isset($node_types)) {
foreach (module_implements('node_info') as $module) {
$node_types[$module] = call_user_func($module . '_node_info');
}
}
if (isset($node_types[$file->name])) {
foreach ($node_types[$file->name] as $node_type => $node_info) {
if (commons_bw_node_auto_title_instance($node_type)) {
$info['features_exclude']['dependencies']['commons_bw'] = 'commons_bw';
}
}
}
}