function ultimate_cron_prepare_hooks in Ultimate Cron 7.2
Prepare the hooks by adding default values.
Parameters
array &$hooks: The hooks to be prepared.
1 call to ultimate_cron_prepare_hooks()
- ultimate_cron_get_hooks in ./
ultimate_cron.module - Get all cron hooks defined.
File
- ./
ultimate_cron.module, line 1432
Code
function ultimate_cron_prepare_hooks(&$hooks) {
// Add default settings.
static $plugin_types;
static $plugins;
if (!isset($plugin_types)) {
ctools_include('plugins');
$plugin_types = ctools_plugin_get_plugin_type_info();
$plugins = array();
foreach ($plugin_types['ultimate_cron'] as $plugin_type => $info) {
$plugins[$plugin_type] = _ultimate_cron_plugin_load_all($plugin_type);
}
}
foreach ($hooks as $name => &$item) {
foreach ($plugin_types['ultimate_cron'] as $plugin_type => $info) {
$static = $info['defaults']['static'];
$class = $static['class'];
$item += array(
$plugin_type => array(),
);
if (!$class::$multiple) {
$item[$plugin_type] += array(
'name' => variable_get('ultimate_cron_plugin_' . $plugin_type . '_default', $static['default plugin']),
);
}
foreach ($plugins[$plugin_type] as $plugin_name => $plugin) {
if (!$plugin
->isValid()) {
continue;
}
$item[$plugin_type] += array(
$plugin_name => array(),
);
}
}
$item += array(
'title' => $name,
'description' => isset($item['title']) ? $item['title'] : $name,
'file path' => drupal_get_path('module', $item['module']),
'callback arguments' => array(),
'callback' => $name,
'enabled' => TRUE,
'tags' => array(),
'api_version' => 'ultimate_cron-2',
'pass job argument' => TRUE,
);
}
}