You are here

function theming_example_select_form in Examples for Developers 7

A simple form that displays a select box and submit button.

This form will be be themed by the 'theming_example_select_form' theme handler.

Related topics

1 string reference to 'theming_example_select_form'
theming_example_menu in theming_example/theming_example.module
Implements hook_menu().

File

theming_example/theming_example.module, line 212
Explains how a module declares theme functions, preprocess functions, and templates.

Code

function theming_example_select_form($form, &$form_state) {
  $options = array(
    'newest_first' => t('Newest first'),
    'newest_last' => t('Newest last'),
    'edited_first' => t('Edited first'),
    'edited_last' => t('Edited last'),
    'by_name' => t('By name'),
  );
  $form['choice'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#title' => t('Choose which ordering you want'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Go'),
  );
  return $form;
}