You are here

function oauth_common_edit_form_auth_level in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.admin.inc \oauth_common_edit_form_auth_level()
  2. 7.3 oauth_common.admin.inc \oauth_common_edit_form_auth_level()

Helper function for constructing a auth level fieldset.

Parameters

object $context:

int $idx:

string $title:

string $name:

array $level:

Return value

array.

2 calls to oauth_common_edit_form_auth_level()
oauth_common_ahah_add_auth_level in ./oauth_common.admin.inc
Menu system callback for adding auth levels
oauth_common_edit_form_context in ./oauth_common.admin.inc
Form to edit the settings of an context.

File

./oauth_common.admin.inc, line 333

Code

function oauth_common_edit_form_auth_level($context, $idx, $title, $name = '', $level = array()) {
  $level = $level + array(
    'title' => '',
    'description' => '',
  );
  $element = array(
    '#theme' => 'oauth_common_auth_level',
    "l_{$idx}_name" => array(
      '#type' => 'textfield',
      '#title' => t('Name'),
      '#description' => t('The name of the authorization level.'),
      '#size' => 40,
      '#maxlength' => 32,
      '#default_value' => $name,
      '#oauth_common_panel' => 'left',
    ),
    "l_{$idx}_title" => array(
      '#type' => 'textfield',
      '#title' => t('Title'),
      '#description' => t('The title of the authorization level.'),
      '#size' => 40,
      '#maxlength' => 100,
      '#default_value' => $level['title'],
      '#oauth_common_panel' => 'left',
    ),
    "l_{$idx}_default" => array(
      '#type' => 'checkbox',
      '#title' => t('Selected by default'),
      '#description' => t('Whether the authentication level should be checked by default.'),
      '#default_value' => is_array($context->authorization_options['default_authorization_levels']) && in_array($name, $context->authorization_options['default_authorization_levels']),
      '#oauth_common_panel' => 'left',
    ),
    "l_{$idx}_delete" => array(
      '#type' => 'checkbox',
      '#title' => t('Delete'),
      '#description' => t('Check this to delete the authorization level.'),
      '#default_value' => FALSE,
      '#oauth_common_panel' => 'left',
    ),
    "l_{$idx}_description" => array(
      '#type' => 'textarea',
      '#title' => t('Description'),
      '#description' => t('The description of the authorization level.'),
      '#default_value' => $level['description'],
      '#oauth_common_panel' => 'right',
    ),
  );
  return $element;
}