You are here

function ultimate_cron_plugin_crontab_element_validate_rule in Ultimate Cron 7.2

Form element validator for cron rules.

1 string reference to 'ultimate_cron_plugin_crontab_element_validate_rule'
UltimateCronCrontabScheduler::settingsForm in plugins/ultimate_cron/scheduler/crontab.class.php
Settings form for the crontab scheduler.

File

./ultimate_cron.module, line 1541

Code

function ultimate_cron_plugin_crontab_element_validate_rule($element, &$form_state) {
  $rules = array();
  $value = $element['#value'];
  if (!empty($value)) {
    $rules = explode(';', $value);
    $rules = array_map('trim', $rules);
  }
  foreach ($rules as $rule) {
    if (!ultimate_cron_validate_rule($rule)) {
      form_error($element, t('%name: %rule is not a valid rule.', array(
        '%name' => $element['#title'],
        '%rule' => $rule,
      )));
    }
  }
}