You are here

function biblio_admin_author_types_form in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_author_types_form()
  2. 6 biblio.admin.inc \biblio_admin_author_types_form()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_author_types_form()

_state

Parameters

$form:

$op:

$id:

Return value

void|multitype:string multitype:string number NULL multitype:string number multitype:string NULL multitype:string number boolean NULL NULL

2 string references to 'biblio_admin_author_types_form'
biblio_forms in ./biblio.module
biblio_menu in ./biblio.module
Implements hook_menu().

File

includes/biblio.admin.inc, line 1980
biblio.admin.inc

Code

function biblio_admin_author_types_form($form, &$form_state, $op = NULL, $id = NULL) {
  switch ($op) {
    case 'edit':
      $type = db_query("SELECT * FROM {biblio_contributor_type_data} WHERE auth_type=:atype", array(
        ':atype' => $id,
      ))
        ->fetchObject();
      $form['auth_type'] = array(
        '#type' => 'hidden',
        '#value' => $type->auth_type,
      );

    // Fall through and use the same form used for a new entry.
    case 'new':
      $form['title'] = array(
        '#type' => 'textfield',
        '#title' => t('Type Name'),
        '#size' => 20,
        '#weight' => 1,
        '#default_value' => $op == 'new' ? '' : $type->title,
        '#required' => TRUE,
        '#maxlength' => 64,
      );
      $form['hint'] = array(
        '#type' => 'textfield',
        '#title' => t('Description'),
        '#size' => 60,
        '#weight' => 2,
        '#default_value' => $op == 'new' ? '' : $type->hint,
        '#maxlength' => 255,
      );
      $form['type_button'] = array(
        '#type' => 'submit',
        '#value' => $op == 'new' ? t('Create New Type') : t('Save'),
        '#weight' => 3,
        '#submit' => array(
          'biblio_admin_author_types_form_submit',
        ),
      );
      $form['cancel_button'] = array(
        '#type' => 'submit',
        '#value' => t('Cancel'),
        '#weight' => 4,
      );
      $form['#theme'] = '';
      return $form;
      break;
    case 'hide':
      break;
    default:
      return;
  }
}