You are here

function registration_state_form in Entity Registration 7

Same name and namespace in other branches
  1. 8.2 includes/registration.forms.inc \registration_state_form()
  2. 8 includes/registration.forms.inc \registration_state_form()
  3. 7.2 includes/registration.forms.inc \registration_state_form()

Generates the Registration state editing form.

File

includes/registration.forms.inc, line 839
Form definitions and callbacks for Registration.

Code

function registration_state_form($form, &$form_state, $registration_state, $op = 'edit') {
  $form['label'] = array(
    '#title' => t('Label'),
    '#type' => 'textfield',
    '#default_value' => $registration_state->label,
    '#description' => t('The human-readable name of this registration state.'),
    '#required' => TRUE,
    '#size' => 30,
  );

  // Machine-readable type name.
  $form['name'] = array(
    '#type' => 'machine_name',
    '#default_value' => $registration_state
      ->identifier(),
    '#maxlength' => 32,
    //'#disabled' => $registration_state->locked && $op != 'clone',
    '#machine_name' => array(
      'exists' => 'registration_get_states',
      'source' => array(
        'label',
      ),
    ),
    '#description' => t('A unique machine-readable name for
    this registration state. It must only contain lowercase letters,
     numbers, and underscores.'),
  );
  $form['default_state'] = array(
    '#title' => t('Default'),
    '#type' => 'checkbox',
    '#default_value' => isset($registration_state->default_state) ? $registration_state->default_state : 0,
    '#attributes' => array(
      'class' => array(
        'reg-default',
      ),
    ),
  );
  $form['weight'] = array(
    '#title' => t('Weight'),
    '#type' => 'weight',
    '#default_value' => isset($registration_state->weight) ? $registration_state->weight : 0,
    '#delta' => 15,
    '#attributes' => array(
      'class' => array(
        'registration-state-weight',
      ),
    ),
  );
  $form['description'] = array(
    '#title' => t('Description'),
    '#type' => 'textfield',
    '#default_value' => isset($registration_state->description) ? $registration_state->description : '',
    '#maxlength' => 128,
    '#size' => 50,
  );
  $form['active'] = array(
    '#title' => t('Active'),
    '#type' => 'checkbox',
    '#default_value' => isset($registration_state->active) ? $registration_state->active : 0,
  );
  $form['held'] = array(
    '#title' => t('Held'),
    '#type' => 'checkbox',
    '#default_value' => isset($registration_state->held) ? $registration_state->held : 0,
  );
  $form['show_on_form'] = array(
    '#title' => t('Show on form'),
    '#type' => 'checkbox',
    '#default_value' => isset($registration_state->show_on_form) ? $registration_state->show_on_form : 0,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Registration state'),
    '#weight' => 40,
  );
  return $form;
}