You are here

function oauthconnector_field_form in OAuth Connector 7

2 string references to 'oauthconnector_field_form'
oauthconnector_list_fields in ./oauthconnector.admin.inc
Output a list of fields.
oauthconnector_menu in ./oauthconnector.module
Implements hook_menu().

File

./oauthconnector.admin.inc, line 867
Administrative functions for the OAuth Connector module.

Code

function oauthconnector_field_form($form, &$form_state, $field_name = '') {
  $field = oauthconnector_fields($field_name);
  $form['old_name'] = array(
    '#type' => 'value',
    '#value' => $field_name,
  );
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#description' => t('A human-readable title for the field.'),
    '#size' => 32,
    '#maxlength' => 255,
    '#required' => TRUE,
    '#default_value' => isset($field['title']) ? $field['title'] : '',
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 24,
    '#default_value' => $field_name,
    '#title' => t('Name'),
    '#description' => t('A unique machine-readable name used to identify this provider internally. It may only contain lowercase alphanumeric characters and underscores. No spaces or uppercase characters.'),
    '#required' => TRUE,
    '#machine_name' => array(
      'exists' => 'oauthconnector_fields',
      'source' => array(
        'title',
      ),
    ),
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t('A description for this field.'),
    '#maxlength' => 255,
    '#rows' => 2,
    '#required' => FALSE,
    '#default_value' => isset($field['description']) ? $field['description'] : '',
  );
  $form['required'] = array(
    '#type' => 'checkbox',
    '#title' => t('Required'),
    '#required' => FALSE,
    '#default_value' => isset($field['required']) && $field['required'] ? 1 : 0,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => empty($field_name) ? t('Add field') : t('Edit field'),
  );
  return $form;
}