You are here

function taxonomy_access_admin_build_row in Taxonomy Access Control 6

Same name and namespace in other branches
  1. 5.2 taxonomy_access_admin.inc \taxonomy_access_admin_build_row()
  2. 7 taxonomy_access.admin.inc \taxonomy_access_admin_build_row()

Assembles a row of grant options for a term or default on the admin form.

Parameters

$grants: An array of grants to use as form defaults, if any.

1 call to taxonomy_access_admin_build_row()
taxonomy_access_admin_form in ./taxonomy_access.admin.inc
Form for managing grants by role.

File

./taxonomy_access.admin.inc, line 142
Administrative interface for taxonomy access control.

Code

function taxonomy_access_admin_build_row($grants = NULL) {
  $form['#title'] = '';
  $form['#tree'] = TRUE;
  foreach (array(
    'view',
    'update',
    'delete',
  ) as $grant) {
    $form[$grant] = array(
      '#type' => 'radios',
      // 1: Allow, 0: Ignore, 2: Deny
      '#options' => array(
        '1' => '',
        '0' => '',
        '2' => '',
      ),
      '#default_value' => is_string($grants['grant_' . $grant]) ? $grants['grant_' . $grant] : '0',
      '#required' => TRUE,
    );
  }
  foreach (array(
    'create',
    'list',
  ) as $grant) {
    $form[$grant] = array(
      '#type' => 'checkbox',
      '#default_value' => is_string($grants['grant_' . $grant]) ? $grants['grant_' . $grant] : '0',
    );
  }
  return $form;
}