Create administration pages with Views 2
When you get an editor asking how they can manage content on a Drupal site, sometimes you just can’t send them to admin/content/node page to manage the site. Maybe you only want certain editors to manage only certain content types. With the Views 2 module it’s easy to create custom administration pages.
When I say administration pages all that’s really required is a table based views page with exposed filters.
Getting started
First of all make sure you have Views 2 installed and working. This will be the only module required.
For this example I’ll create one custom administration page which will display the story and page content type.
But of course in the real world you’ll have to display your custom content types.
Creating the page
Go to the Views page at Administer >> Site building >> Views and create a views called admin_manager and type Node then click on Next.
Create a new page called Page manager.
The next step is to create the URL to the page. Because we want it to appear under the Content management section the URL should look like admin/content/page-manager. You can change the page-manager to be anything, just make sure the page is under admin/content.
If you want the page to appear under the Site configuration then just change admin/content/page-manager to admin/settings/page-manager.
For it to appear under the Content management section we must create a menu item. Click on the Menu link under the Page settings and select Normal menu entry, add a title and select Navigation from the Menu dropdown.
By adding “admin/content” to the path Drupal will automatically add the menu item under the Content management section.
For this Page Manager view I just want it to display a table with the node title and body field.
Once you have added all the required fields, save the view and you should see aCustom page manager link under the Content management section on the /admin page. If you don’t see the menu item, go back to the admin_manager view and check the Menu item entry.
Controlling access to the page
By default when you create a views page anyone can access the page. For this administration page to be useful we must be able to control who has access to the page. Luckily the views module gives you the ability to assign access based off role or permission.
However if you assign the “access all views” permission to anonymous or authenticated users this will override anything that was setup in the views access settings.
When testing out the page make sure you test it as an anonymous and authenticated user just to make sure no one can access it.
Views Bulk Operations
On a side note, check out the Views Bulk Operations (VBO) module. The module ships with a view which is kind of a replacement for the Content page (admin/content/node).
Just download and enable the module. Go to the administration views page (admin/build/views) and you should see the admin_content view.
Because this page is a view you can clone and then customise it.
If you have any questions or know of other administration type modules leave a comment.