123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <?php
- function page_example_help($path, $arg) {
- switch ($path) {
- case 'examples/page_example/simple':
-
- return t('This is help text for the simple page.');
- case 'admin/help#page_example':
-
- return t("This is help text created in the page example's second case.");
- }
- }
- function page_example_permission() {
- return array(
- 'access simple page' => array(
- 'title' => t('Access simple page'),
- 'description' => t('Allow users to access simple page'),
- ),
- 'access arguments page' => array(
- 'title' => t('Access page with arguments'),
- 'description' => t('Allow users to access page with arguments'),
- ),
- );
- }
- function page_example_menu() {
-
-
- $items['examples/page_example'] = array(
- 'title' => 'Page Example',
- 'page callback' => 'page_example_description',
- 'access callback' => TRUE,
- 'expanded' => TRUE,
- );
- $items['examples/page_example/simple'] = array(
- 'title' => 'Simple - no arguments',
- 'page callback' => 'page_example_simple',
- 'access arguments' => array('access simple page'),
- );
-
-
-
-
-
-
-
-
-
- $items['examples/page_example/arguments/%/%'] = array(
- 'page callback' => 'page_example_arguments',
- 'page arguments' => array(3, 4),
- 'access arguments' => array('access arguments page'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
- }
- function page_example_description() {
- return array(
- '#markup' =>
- t('<p>The page_example provides two pages, "simple" and "arguments".</p><p>The <a href="@simple_link">simple page</a> just returns a renderable array for display.</p><p>The <a href="@arguments_link">arguments page</a> takes two arguments and displays them, as in @arguments_link</p>',
- array(
- '@simple_link' => url('examples/page_example/simple', array('absolute' => TRUE)),
- '@arguments_link' => url('examples/page_example/arguments/23/56', array('absolute' => TRUE)),
- )
- ),
- );
- }
- function page_example_simple() {
- return array('#markup' => '<p>' . t('Simple page: The quick brown fox jumps over the lazy dog.') . '</p>');
- }
- function page_example_arguments($first, $second) {
-
- if (!is_numeric($first) || !is_numeric($second)) {
-
- drupal_access_denied();
-
- return;
- }
- $list[] = t("First number was @number.", array('@number' => $first));
- $list[] = t("Second number was @number.", array('@number' => $second));
- $list[] = t('The total was @number.', array('@number' => $first + $second));
- $render_array['page_example_arguments'] = array(
-
- '#theme' => 'item_list',
-
- '#items' => $list,
- '#title' => t('Argument Information'),
- );
- return $render_array;
- }
|