Advertisement
kenrbnsn

D7 Custom Menu Problem

Oct 25th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2. function productmenu_menu() {
  3.         global $base_url;
  4.         $top_level = array('Color Printers','Black & White Printers','Color MFP','Black & White MFP','Wide Format','Fax Machines');
  5.         $items['productmenu/products'] = array(
  6.             'title' => 'New Products',
  7.             'access callback' => TRUE,
  8. //          'menu_name' => 'Test Menu',
  9.             'expanded' => TRUE,
  10.             'page callback' => '_productmenu_menu_page',
  11.             'page arguments' => array('Top Level'),
  12.             'type' => MENU_NORMAL_ITEM,
  13.       );
  14.       $id = 10000;
  15.       foreach ($top_level as $cat) {
  16.                 $items["productmenu/products/" . urlencode($cat)] = array(
  17.                     'title' => $cat,
  18.                     'page callback' => '_productmenu_menu_page',
  19.                     'page arguments' => array(url("$base_url/productscategory/$id")),
  20.                     'access callback' => TRUE,
  21.                     'expanded' => TRUE,
  22.                 );
  23.                                 $id++;
  24.       }
  25.       dpm($items);
  26. //    file_put_contents('/tmp/drupal.debug',print_r($items,true));
  27.     return $items;
  28. }
  29. function _productmenu_menu_page($arg1 = NULL, $arg2 = NULL) {
  30.     $output = '';
  31.     if ($arg1 != '') {
  32.         $output = "location: $arg1";
  33.     }
  34.     return $output;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement