When managers log in to the Gamerz IS, they see a control panel (CP).
It’s a list of links for tasks that managers need to do. BTW, “control panel” isn’t an official Drupal term, just something that makes sense to people.
You can try it. Go to the login page. (https://gamerz.cybercour.se/user/login) Log in with the user name manager
, and the password password
. You won’t be able to change the data, but otherwise, you’ll see what managers see.
What is it, really?
The CP isn’t a new type of thing. It’s just a block with a menu in it. That’s all.
Making the CP
First, make a new menu. Structure | Menus, Add menu. Give the menu a title, and save.
The menu has no links at the moment. Let’s add some.
There are several ways to add links to a menu:
- When editing a page
- In views
- Manually
When editing a page
You’ve been doing this for a while now. When you edit a page, you can tell Drupal to make a menu item for it. You’ve been adding pages to the main menu. To add a page to the CP, select that menu:
However, you won’t see the menu on the list, unless you’ve configured the content type to allow it.
So, if you don’t see the menu you want in the list, check whether the content type allows it.
Here’s the CP again:
There aren’t any links to pages in the CP, so we won’t need to make any. If we had, say, a Basic page with instructions for managers, we’d put a link to the page in the CP.
Menu links from views
You can create menu link for views. Here’s adding the Org people view to the CP:
Half of the links in the CP are links to views. Here they are, marked with bacon:
One problem is that some of the views have links in two menus. Manage projects, for example, has a link in the main menu, and in the CP. Views can only have one menu item at a time. For those links, and for links that aren’t for views, you need to make the links manually.
Making links manually
To add a link manually, Structure | Menus | Org control panel, Add link.
You need to tell Drupal the text for the link, and the URL. Let’s add the Add person link. The text is “Add person”. To find the URL, go to the page you would use to add a person. In the admin menu, click Content, then Add content, then Person. You’ll see the usual page for adding content of type Person:
Look at the URL. That tells you the URL you need for the Add person link in the CP. Type it in:
Don’t type in the domain, but do remember to include the leading /. Oh, and select the right menu for the Parent.
There’s another way to find the URL to use for a menu link. Take Logout. There are logout links on other menus. If I find one, I can put the mouse cursor on the link, and see the destination in the browser:
The URL is /user/logout
.
Showing the menu block
When you create a menu, Drupal automatically creates a block for it. You show the menu by showing the block.
Go to Structure | Block layout. Find the region you want to add the menu block to, and click Place block.
Choose the block to place. Then configure it to show only to the right roles:
Exercise
gamerz
site, like the one on the sample site.
Make sure it only shows up for managers.
Submit the URL of your site, and the login credentials for user 1.(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)
Summary
The manager CP is a menu. Make the menu, and add links to it by:
- Adding menu links to pages (not needed in this case)
- Setting the menu link of a view
- Adding menu links manually
To show the menu, configure the menu’s block.