public function ultimate_cron_job_ctools_export_ui::list_form in Ultimate Cron 7.2
Create the filter/sort form at the top of a list of exports.
This handles the very default conditions, and most lists are expected to override this and call through to parent::list_form() in order to get the base form and then modify it as necessary to add search gadgets for custom fields.
Overrides ctools_export_ui::list_form
File
- plugins/
ctools/ export_ui/ ultimate_cron_job_ctools_export_ui.class.php, line 281 - Export-ui handler for the Ultimate Cron jobs.
Class
- ultimate_cron_job_ctools_export_ui
- Class for cTools Export UI.
Code
public function list_form(&$form, &$form_state) {
parent::list_form($form, $form_state);
$class = _ultimate_cron_get_class('job');
$lock_ids = $class::isLockedMultiple($this->items);
$log_entries = $class::loadLatestLogEntries($this->items);
$progresses = $class::getProgressMultiple($this->items);
foreach ($this->items as $name => $item) {
$item->log_entry = isset($item->log_entry) ? $item->log_entry : $log_entries[$name];
$item->progress = isset($item->progress) ? $item->progress : $progresses[$name];
$item->lock_id = isset($item->lock_id) ? $item->lock_id : $lock_ids[$name];
}
$form['#attached']['js'][] = drupal_get_path('module', 'ultimate_cron') . '/js/ultimate_cron.js';
if (module_exists('nodejs')) {
$settings = _ultimate_cron_plugin_require('settings', 'general')
->getDefaultSettings();
if (!empty($settings['nodejs'])) {
nodejs_send_content_channel_token('ultimate_cron');
$form['#attached']['js'][] = drupal_get_path('module', 'ultimate_cron') . '/js/ultimate_cron.nodejs.js';
}
}
// There's no normal for Ultimate Cron!
unset($form['top row']['storage']['#options'][t('Normal')]);
$all = array(
'all' => t('- All -'),
);
$options = $all + array(
'running' => 'running',
-1 => 'no info',
) + watchdog_severity_levels();
$form['top row']['status'] = array(
'#type' => 'select',
'#title' => t('Status'),
'#options' => $options,
'#default_value' => 'all',
'#weight' => -2,
);
$jobs = ultimate_cron_get_hooks();
$modules = array();
foreach ($jobs as $job) {
$info = system_get_info('module', $job['module']);
$modules[$job['module']] = $info && !empty($info['name']) ? $info['name'] : $job['module'];
}
$form['top row']['module'] = array(
'#type' => 'select',
'#title' => t('Module'),
'#options' => $all + $modules,
'#default_value' => 'all',
'#weight' => -1,
);
$form['bottom row']['reload'] = array(
'#type' => 'submit',
'#id' => 'ctools-export-ui-list-items-reload',
'#value' => t('Reload'),
'#attributes' => array(
'class' => array(
'use-ajax-submit',
),
),
);
}