function trigger_assign_form_validate

7.x trigger.admin.inc trigger_assign_form_validate($form, $form_state)

Form validation handler for trigger_assign_form().

Makes sure that the user is not re-assigning an action to an event.

See also

trigger_assign_form_submit()

1 string reference to 'trigger_assign_form_validate'
trigger_assign_form in drupal/modules/trigger/trigger.admin.inc
Returns the form for assigning an action to a trigger.

File

drupal/modules/trigger/trigger.admin.inc, line 212
Admin page callbacks for the trigger module.

Code

function trigger_assign_form_validate($form, $form_state) {
  $form_values = $form_state['values'];
  if (!empty($form_values['aid'])) {
    $aid = actions_function_lookup($form_values['aid']);
    $aid_exists = db_query("SELECT aid FROM {trigger_assignments} WHERE hook = :hook AND aid = :aid", array(
      ':hook' => $form_values['hook'],
      ':aid' => $aid,
    ))->fetchField();
    if ($aid_exists) {
      form_set_error($form_values['hook'], t('The action you chose is already assigned to that trigger.'));
    }
  }
}