function form_example_menu in Examples for Developers 6
Same name and namespace in other branches
- 7 form_example/form_example.module \form_example_menu()
Implements hook_menu() to set up the URLs (menu entries) for the form examples.
File
- form_example/
form_example.module, line 24 - Examples demonstrating the Drupal Form API.
Code
function form_example_menu() {
$items['examples/form_example'] = array(
'title' => t('Form Example'),
'page callback' => 'form_example_info',
'access callback' => TRUE,
);
$items['examples/form_example/tutorial'] = array(
'title' => t('Tutorial'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_1',
),
'access callback' => TRUE,
'description' => t('A set of ten tutorials'),
'file' => 'form_example_tutorial.inc',
'weight' => -20,
);
$items['examples/form_example/tutorial/1'] = array(
'title' => t('#1'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_1',
),
'access callback' => TRUE,
'description' => t('Tutorial 1: Simplest form'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/2'] = array(
'title' => t('#2'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_2',
),
'access callback' => TRUE,
'description' => t('Tutorial 2: Form with a submit button'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/3'] = array(
'title' => t('#3'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_3',
),
'access callback' => TRUE,
'description' => t('Tutorial 3: Fieldsets'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/4'] = array(
'title' => t('#4'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_4',
),
'access callback' => TRUE,
'description' => t('Tutorial 4: Required fields'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/5'] = array(
'title' => t('#5'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_5',
),
'access callback' => TRUE,
'description' => t('Tutorial 5: More element attributes'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/6'] = array(
'title' => t('#6'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_6',
),
'access callback' => TRUE,
'description' => t('Tutorial 6: Form with a validate handler'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/7'] = array(
'title' => t('#7'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_7',
),
'access callback' => TRUE,
'description' => t('Tutorial 7: Form with a submit handler'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/8'] = array(
'title' => t('#8'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_8',
),
'access callback' => TRUE,
'description' => t('Tutorial 8: Form with a reset button'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/9'] = array(
'title' => t('#9'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_9',
),
'access callback' => TRUE,
'description' => t('Tutorial 9: Form with dynamically added new fields'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
);
$items['examples/form_example/tutorial/10'] = array(
'title' => t('#10'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_10',
),
'access callback' => TRUE,
'description' => t('Tutorial 10: Basic multistep form'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
'weight' => 10,
);
$items['examples/form_example/tutorial/11'] = array(
'title' => t('#11'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_tutorial_11',
),
'access callback' => TRUE,
'description' => t('Tutorial 11: Form with file upload'),
'type' => MENU_LOCAL_TASK,
'file' => 'form_example_tutorial.inc',
'weight' => 11,
);
$items['examples/form_example/element_example'] = array(
'title' => 'Element example',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'form_example_element_demo_form',
),
'access callback' => TRUE,
'file' => 'form_example_elements.inc',
);
return $items;
}