You are here

function _config_perms_form in Custom Permissions 6.2

Permissions table for the administration form

2 calls to _config_perms_form()
config_perms_admin_form in ./config_perms.admin.inc
Administration form
config_perms_ahah in ./config_perms.admin.inc
Interface for the AHAH management.

File

./config_perms.admin.inc, line 41
Admin pages

Code

function _config_perms_form($perms) {
  $form = array();
  foreach ($perms as $key => $perm) {
    $attributes = in_array($perm->id, array(
      1,
      2,
    )) ? array(
      'disabled' => $disabled,
    ) : array();
    $form[$key] = array(
      '#tree' => TRUE,
    );
    $form[$key]['pid'] = array(
      '#type' => 'hidden',
      '#default_value' => check_plain($perm->pid),
    );
    $form[$key]['machine_name'] = array(
      '#type' => 'hidden',
      '#default_value' => check_plain($perm->machine_name),
    );
    $form[$key]['status'] = array(
      '#type' => 'checkbox',
      '#default_value' => check_plain($perm->status),
      '#attributes' => $attributes,
    );
    $form[$key]['remove'] = array(
      '#type' => 'checkbox',
      '#default_value' => check_plain($perm->remove),
      '#attributes' => $attributes,
    );
    $form[$key]['name'] = array(
      '#type' => 'textfield',
      '#default_value' => check_plain($perm->name),
      '#size' => 30,
      '#attributes' => $attributes,
    );
    $form[$key]['path'] = array(
      '#type' => 'textarea',
      '#default_value' => config_perms_parse_path($perm->path),
      '#size' => 50,
      '#rows' => 2,
      '#attributes' => $attributes,
    );
  }

  // Add the entry fields
  $key = count($perms);
  $form[$key]['status'] = array(
    '#name' => 'status',
    '#id' => 'edit-local-status',
    '#type' => 'submit',
    '#value' => t('Add'),
    '#ahah' => array(
      'path' => 'config_perms/ahah',
      'wrapper' => 'config_perms-wrapper',
    ),
  );
  $form[$key]['name'] = array(
    '#type' => 'textfield',
    '#default_value' => check_plain($new->name),
    '#size' => 30,
  );
  $form[$key]['path'] = array(
    '#type' => 'textarea',
    '#default_value' => check_plain($new->path),
    '#rows' => 2,
    '#size' => 50,
  );
  $form[$key]['remove'] = array(
    '#value' => '',
  );
  return $form;
}