You are here

function theme_simple_access_form in Simple Access 5

Same name and namespace in other branches
  1. 5.2 simple_access.module \theme_simple_access_form()
  2. 6.2 simple_access.theme.inc \theme_simple_access_form()
  3. 7.2 simple_access.theme.inc \theme_simple_access_form()
1 theme call to theme_simple_access_form()
simple_access_form in ./simple_access.module

File

./simple_access.module, line 269
This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.

Code

function theme_simple_access_form($form) {
  $variable = variable_get('sa_display', array(
    'view' => 1,
  ));
  $head = array(
    t('Access Group'),
  );
  if ($variable['view']) {
    $head[] = t('View');
  }
  if ($variable['update']) {
    $head[] = t('Update');
  }
  if ($variable['delete']) {
    $head[] = t('Delete');
  }
  foreach (element_children($form) as $gid) {
    $row = array(
      array(
        'data' => drupal_render($form[$gid]['name']),
      ),
    );
    if ($variable['view']) {
      $row[] = array(
        'data' => drupal_render($form[$gid]['view']),
      );
    }
    if ($variable['update']) {
      $row[] = array(
        'data' => drupal_render($form[$gid]['update']),
      );
    }
    if ($variable['delete']) {
      $row[] = array(
        'data' => drupal_render($form[$gid]['delete']),
      );
    }
    $rows[] = $row;
  }
  $output .= theme('table', $head, $rows);
  return $output;
}