You are here

function theme_access_filter_overview_filters in Access Filter 7

Returns HTML for the access filter overview form as a list of filters.

Parameters

array $variables: An associative array containing:

  • form: A render element representing the form.

See also

access_filter_overview_filters()

File

./access_filter.admin.inc, line 139
Administration pages for access filters.

Code

function theme_access_filter_overview_filters($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['name'])) {
      $filter =& $form[$key];
      $row = array();
      $row[] = drupal_render($filter['enabled']);
      $row[] = drupal_render($filter['name']);
      $row[] = drupal_render($filter['paths']);
      $row[] = drupal_render($filter['rules']);
      $row[] = drupal_render($filter['action']);
      if (isset($filter['weight'])) {
        $filter['weight']['#attributes']['class'] = array(
          'access-filter-weight',
        );
        $row[] = drupal_render($filter['weight']);
      }
      $row[] = drupal_render($filter['edit']);
      $row[] = drupal_render($filter['delete']);
      $rows[] = array(
        'data' => $row,
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  $header = array(
    t('Enabled'),
    t('Name'),
    t('Paths'),
    t('Rules'),
    t('Actions On deny'),
  );
  if (isset($form['actions'])) {
    $header[] = t('Weight');
    drupal_add_tabledrag('access-filter', 'order', 'sibling', 'access-filter-weight');
  }
  $header[] = array(
    'data' => t('Operations'),
    'colspan' => '2',
  );
  $markup = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No filters available. <a href="@link">Add filter</a>.', array(
      '@link' => url('admin/config/people/access_filter/add'),
    )),
    'attributes' => array(
      'id' => 'access-filter',
    ),
  ));
  return $markup . drupal_render_children($form);
}