function command_buttons_modules_enabled in Command Buttons 7
Implements hook_modules_enabled().
It's kind of strange that we initially add node command buttons here, but we needed to wait for features to add the correct fields to our bundle and hook_modules_enabled happens late enough that we can safely save our entities.
File
- ./
command_buttons.module, line 146
Code
function command_buttons_modules_enabled($modules) {
// check if fields exists, and if not, create them via features_revert
$instance = field_info_instance('command_button', 'field_command_link', 'button');
if (empty($instance)) {
features_revert(array(
'command_buttons' => array(
'field_instance',
'field_base',
),
));
}
if (in_array('command_buttons', $modules)) {
$node_type = entity_get_info('node');
foreach ($node_type['bundles'] as $bundle => $definition) {
command_buttons_create_node_button($bundle, $definition['label']);
}
}
}