You are here

function field_validation_callback_dispatch in Field Validation 7

Menu callback function using to dispatch.

1 string reference to 'field_validation_callback_dispatch'
field_validation_menu in ./field_validation.module
Implements hook_menu().

File

./field_validation.admin.inc, line 11
Manages validation rules administration UI

Code

function field_validation_callback_dispatch($instance, $arg1 = NULL, $arg2 = NULL, $arg3 = NULL) {
  $output = '';
  if (empty($arg1)) {
    drupal_set_title(t('Validation'));
    $output .= field_validation_manage($instance);
  }
  elseif ($arg1 == 'add') {
    drupal_set_title(t('Add validation'));
    $form = drupal_get_form('field_validation_manage_rule', $instance, 'add', $arg2);
    $output .= drupal_render($form);
  }
  elseif ($arg1 == 'edit') {
    drupal_set_title(t('Edit rule'));
    $form = drupal_get_form('field_validation_manage_rule', $instance, 'edit', $arg2, $arg3);
    $output .= drupal_render($form);
  }
  elseif ($arg1 == 'delete') {
    drupal_set_title(t('Delete rule'));
    $form = drupal_get_form('field_validation_delete_rule', $arg2);
    $output .= drupal_render($form);
  }
  elseif ($arg1 == 'overwrite') {
    drupal_set_title(t('Overwrite rule'));
    $form = drupal_get_form('field_validation_manage_rule', $instance, 'edit', $arg2, $arg3);
    $output .= drupal_render($form);
  }
  else {
    drupal_set_title(t('Validation'));
    $output .= field_validation_manage($instance);
  }
  return $output;
}