function commerce_file_system_info_alter in Commerce File 7
Implements hook_system_info_alter().
- Temporary fix to address field module not allowing disabling this module if there are still fields of this field type. Fix depends on commerce_file_update_7102().
- @todo remove this when split into separate modules
See also
http://drupal.org/node/1309140
File
- ./
commerce_file.module, line 632 - Provides integration of file licenses with Commerce
Code
function commerce_file_system_info_alter(&$info, $file, $type) {
if ($type == 'module' && $file->name == 'commerce_file') {
// @ref field_system_info_alter()
$fields = field_read_fields(array(
'module' => $file->name,
), array(
'include_deleted' => TRUE,
));
if ($fields) {
// remove fields controlled by this module
$controlled_fields = _commerce_file_get_field_names();
foreach ($fields as $field_id => $field) {
if (in_array($field['field_name'], $controlled_fields)) {
unset($fields[$field_id]);
}
}
// if no more fields, then undo field module
if (empty($fields)) {
unset($info['explanation'], $info['required']);
}
}
}
}