theme_flag_form_roles

  1. drupal
    1. 6 flag.admin.inc function
    2. 7 flag.admin.inc function
Drupal 7 theme_flag_form_roles($variables)

Output the access options for roles in a table.

File

sites/all/modules/flag/includes/flag.admin.inc, line 474
Contains administrative pages for creating, editing, and deleting flags.

Code

function theme_flag_form_roles($variables) {
  $element = $variables['element'];

  $header = array(
    array(
      'class' => array('checkbox'),
      'data' => t('Flag'),
    ),
    array(
      'class' => array('checkbox'),
      'data' => t('Unflag'),
    ),
    t('Role'),
  );
  $rows = array();
  foreach (element_children($element['flag']) as $role) {
    $row = array();
    $role_name = $element['flag'][$role]['#title'];
    unset($element['flag'][$role]['#title']);
    unset($element['unflag'][$role]['#title']);
    $element['flag'][$role]['#attributes']['class'] = array('flag-access');
    $element['unflag'][$role]['#attributes']['class'] = array('unflag-access');
    $row[] = array(
      'class' => array('checkbox'),
      'data' => drupal_render($element['flag'][$role]),
    );
    $row[] = array(
      'class' => array('checkbox'),
      'data' => drupal_render($element['unflag'][$role]),
    );
    $row[] = $role_name;
    $rows[] = $row;
  }

  return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('flag-admin-table'), 'id' => 'flag-roles')));
}