You are here

function ultimate_cron_plugin_settings in Ultimate Cron 7.2

Settings form for plugins.

1 string reference to 'ultimate_cron_plugin_settings'
ultimate_cron_menu in ./ultimate_cron.module
Implements hook_menu().

File

./ultimate_cron.admin.inc, line 26
Ultimate Cron!

Code

function ultimate_cron_plugin_settings($form, &$form_state, $plugin_type, $name) {
  $plugin = _ultimate_cron_plugin_require($plugin_type, $name);
  $form['description'] = array(
    '#markup' => $plugin->description,
  );

  // Sanitize input values.
  if (!isset($form_state['values']['settings'][$plugin_type][$name])) {
    $form_state['values']['settings'][$plugin_type][$name] = array();
  }
  $form_state['values']['settings'][$plugin_type][$name] += $plugin
    ->getDefaultSettings();
  $form_state['default_values']['settings'][$plugin_type][$name] = $form_state['values']['settings'][$plugin_type][$name];
  $form['settings']['#tree'] = TRUE;
  $form['plugin_type'] = array(
    '#type' => 'value',
    '#value' => $plugin_type,
  );
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $name,
  );
  $plugin
    ->settingsForm($form, $form_state);
  if (!empty($form['settings'][$plugin_type][$name]['no_settings'])) {
    return $form;
  }
  $plugin
    ->fallbackalize($form['settings'][$plugin_type][$name], $form_state['values']['settings'][$plugin_type][$name], $form_state['default_values']['settings'][$plugin_type][$name], TRUE);
  $form = system_settings_form($form);
  $form['#validate'] = empty($form['#validate']) ? array() : $form['#validate'];
  $form['#submit'] = empty($form['#submit']) ? array() : $form['#submit'];
  array_unshift($form['#validate'], 'ultimate_cron_plugin_settings_validate');
  array_unshift($form['#submit'], 'ultimate_cron_plugin_settings_submit');
  array_push($form['#submit'], 'ultimate_cron_plugin_settings_clear_cache');
  return $form;
}