You are here

function simple_access_profile_form in Simple Access 7.2

Same name and namespace in other branches
  1. 5.2 simple_access.module \simple_access_profile_form()
  2. 6.2 simple_access.admin.inc \simple_access_profile_form()

Simple Access profile form.

1 string reference to 'simple_access_profile_form'
simple_access_menu in ./simple_access.module
Implements hook_menu().

File

./simple_access.admin.inc, line 199
House all the admin functions in inc to make the foot print a lot smaller.

Code

function simple_access_profile_form($form, $form_state, $profile = array()) {
  $profile += array(
    'access' => FALSE,
  );
  if (!empty($profile['pid'])) {
    $form['pid'] = array(
      '#type' => 'value',
      '#value' => $profile['pid'],
    );
  }
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#default_value' => isset($profile['name']) ? $profile['name'] : '',
    '#required' => TRUE,
  );
  $form['access'] = array(
    '#tree' => TRUE,
    '#theme' => 'simple_access_form',
  );
  $groups = simple_access_group_select();
  foreach ($groups as $gid => $group) {
    $form['access'][$gid] = simple_access_form_row($gid, $group, $profile['access']);
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => empty($profile['pid']) ? t('Submit') : t('Update'),
  );
  return $form;
}