You are here

function oauth_common_edit_form_auth_level in OAuth 1.0 7.3

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

Helper function for constructing an auth level fieldset.

Parameters

object $context:

int $idx:

string $title:

string $name:

array $level:

Return value

array.

1 call to oauth_common_edit_form_auth_level()
oauth_common_edit_form_context in ./oauth_common.admin.inc
Form to edit the settings of a context.

File

./oauth_common.admin.inc, line 352
Administration pages for OAuth module.

Code

function oauth_common_edit_form_auth_level($context, $title, $name = '', $level = array()) {
  $level = $level + array(
    'title' => '',
    'description' => '',
  );
  $element = array(
    "name" => array(
      '#type' => 'textfield',
      '#title' => t('Name'),
      '#description' => t('The name of the authorization level.'),
      '#size' => 40,
      '#maxlength' => 32,
      '#default_value' => $name,
    ),
    "title" => array(
      '#type' => 'textfield',
      '#title' => t('Title'),
      '#description' => t('The title of the authorization level.'),
      '#size' => 40,
      '#maxlength' => 100,
      '#default_value' => $level['title'],
    ),
    "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']),
    ),
    "delete" => array(
      '#type' => 'checkbox',
      '#title' => t('Delete'),
      '#description' => t('Check this to delete the authorization level.'),
      '#default_value' => FALSE,
    ),
    "description" => array(
      '#type' => 'textarea',
      '#title' => t('Description'),
      '#description' => t('The description of the authorization level.'),
      '#default_value' => $level['description'],
    ),
  );
  return $element;
}