You are here

function theme_field_validation_manage_add_rule in Field Validation 7

Theme the 'add rule' list

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

File

./field_validation.module, line 176

Code

function theme_field_validation_manage_add_rule($variables) {
  $instance = $variables['instance'];
  $output = '';
  $validators = field_validation_get_validators();
  if ($validators) {
    $output = '<h3>' . t('Add a validation rule') . '</h3>';
    $output .= '<dl>';
    foreach ($validators as $validator_key => $validator_info) {
      $item = '';
      $path = isset($_GET['q']) ? $_GET['q'] : '';
      $url = $path . '/add/' . $validator_key;
      $components = ' (' . implode(', ', $validator_info['field_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;
}