You are here

function theme_webform_validation_manage_overview in Webform Validation 6

Themable function to list the rules assigned to a webform

1 theme call to theme_webform_validation_manage_overview()
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.admin.inc, line 34
Manages validation rules administration UI

Code

function theme_webform_validation_manage_overview($rules = array(), $node = NULL) {
  $vars = webform_validation_get_vars();
  $suffix = $vars['path_suffix'];
  $header = array(
    t('Rule name'),
    t('Validator'),
    t('Components'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $validators = webform_validation_get_validators_selection();
  if (!empty($rules)) {
    foreach ($rules as $rule) {
      $component_info = webform_validation_rule_components_basic($rule['components']);
      $row = array();
      $row[] = array(
        'data' => check_plain($rule['rulename']),
      );
      $row[] = array(
        'data' => $validators[$rule['validator']],
      );
      $row[] = array(
        'data' => theme('item_list', $component_info),
      );
      $row[] = array(
        'data' => l(t('Edit'), 'node/' . $node->nid . '/' . $suffix . '/validation/edit/' . $rule['validator'] . '/' . $rule['ruleid'], array(
          "query" => drupal_get_destination(),
        )),
      );
      $row[] = array(
        'data' => l(t('Delete'), 'node/' . $node->nid . '/' . $suffix . '/validation/delete/' . $rule['ruleid'], array(
          "query" => drupal_get_destination(),
        )),
      );
      $rows[] = $row;
    }
  }
  else {
    $rows[][] = array(
      'data' => t('No validation rules available.'),
      'colspan' => 5,
    );
  }
  return theme('table', $header, $rows);
}