You are here

function theme_webform_validation_manage_add_rule in Webform Validation 6

Same name and namespace in other branches
  1. 7 webform_validation.module \theme_webform_validation_manage_add_rule()

Theme the 'add rule' list

1 theme call to theme_webform_validation_manage_add_rule()
webform_validation_manage in ./webform_validation.admin.inc
Menu callback function to show an overview of the existing validation rules, and the option to add a rule

File

./webform_validation.module, line 251

Code

function theme_webform_validation_manage_add_rule($nid) {
  $output = '';
  $vars = webform_validation_get_vars();
  $suffix = $vars['path_suffix'];
  $validators = webform_validation_get_validators();
  if ($validators) {
    $output = '<h3>' . t('Add a validation rule') . '</h3>';
    $output .= '<dl>';
    foreach ($validators as $validator_key => $validator_info) {
      $item = '';
      $url = 'node/' . $nid . '/' . $suffix . '/validation/add/' . $validator_key;
      $components = ' (' . implode(', ', $validator_info['component_types']) . ')';
      $item = '<dt>' . l($validator_info['name'], $url, array(
        "query" => drupal_get_destination(),
      )) . '</dt>';
      $item .= '<dd>';
      if ($validator_info['description']) {
        $item .= $validator_info['description'] . ' ';
      }
      $item .= $components . '</dd>';
      $output .= $item;
    }
    $output .= '</dl>';
  }
  return $output;
}