0

Ok, I know there is a tutorial out there somewhere for this, I used it once before. Now, no matter how I search, I can't find it. Basically, I want to create this:

Admin Landing Page showing sub menu items

In other words, an admin landing page with sub menu items.

I have Panels and Page Manager installed and can create the admin page to the point where it shows on the path, but the sub-menu items don't appear. Instead I get this:

Blank admin page

I've cleared the caches, made sure that sub-menu item is under this page, made sure that all the proper permissions are set . . . You know all the stuff that good Drupal developers are supposed to do.

So my two questions are this:

  1. What am I doing wrong?
  2. Can any one give me the step by step for creating what's on the first image with my own custom menu items? Or at least point me in the direction of some tutorials?

Thank you in advance for any help you can provide.

2
  • do you want to show the admin page when admin user logged in ?
    – Bala
    Feb 5, 2014 at 7:11
  • They aren't really an admin user, but a user who will have access to that particular admin section. Feb 5, 2014 at 17:45

3 Answers 3

1

The reliable way to add and see menu options on admin pages is through [PHP] code, using hook_menu(). Be sure each URL is prefixed with admin/... (for example, admin/sub-section/page-1, admin/sub-section/page-2).

Here's a quick snippet paraphrased from the hook_menu() Drupal API docs:

  function mymodule_menu() {
    $items['admin/sub-section/page-1'] = array(
      'page callback' => 'mymodule_page1_view',
    );
    return $items;
  }

  function mymodule_page1_view() {
    // ...
  }

I haven't tried tricking the admin screen by adding custom links with "admin/*" at the front, which may or may not work - but the code option will definitely work, I've used that hook more than a thousand times.

0

In Drupal 7 you can create using hook_menu


    /**
     * Implements hook_menu().
     */
    function hook_menu() {
        $items = array();
        $items['admin/structure/types1'] = array(
            'title' => 'Types 1',
            'description' => 'Your menu types 1 description',
            'page callback' => 'types1_menu_callback',
            'access arguments' => array('Administer types 1'),
        );
        $items['admin/structure/types2'] = array(
            'title' => 'Types 2',
            'description' => 'Your menu types 2 description',
            'page callback' => 'types2_menu_callback',
            'access arguments' => array('Administer types 2'),
        );
        $items['admin/structure/types3'] = array(
            'title' => 'Types 3',
            'description' => 'Your menu types 3 description',
            'page callback' => 'types3_menu_callback',
            'access arguments' => array('Administer types 3'),
        );
        return $items;
    }

    function types1_menu_callback() {
    //Your code for type 1 menu...
    }

    function types2_menu_callback() {
    //Your code for type 2 menu...
    }

    function types3_menu_callback() {
    //Your code for type 3 menu...
    }
  • Create your own permissions using hook_permission

    /**
     * Implements hook_permission().
     */
    function hook_permission() {
        $perms = array(
            'administer types1' => array(
                'title' => t('Administer types 1'),
                'restrict access' => TRUE,
            ),
            'administer types2' => array(
                'title' => t('Administer types 2'),
                'restrict access' => TRUE,
            ),
            'administer types3' => array(
                'title' => t('Administer types 3'),
                'restrict access' => TRUE,
            ),
        );
        return $perms;
    }
-1

in admin/config/system/site-information set the front page to admin/structure

or

go to admin/structure/menus. create a menu with all the links you want on your page. go to admin/structure/blocks - find your menu and configure it to show on the page you want.

1
  • Thank you, but I am not dealing with front page at all. This is specifically recreating the functionality of the Administrative Section Page, which shows the various links in that section. For example, /admin/structure will show /admin/structure/blocks as a link with a description along with everything else that is in the Admin Structure section. Feb 4, 2014 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.