Plugin Use Cases/Add Navigation to the Admin Theme

The following use case leads you through the creation of a plugin that adds a link to the Omeka's main administrative navigation, and creates a link to the Center for History & New Media's website. This basic task can be used for a remote link like in this use case, or in conjunction with the add a page to the admin theme use case.

Files You'll Create in this Use Case

  • FilterAdminNav/ (folder)
    • plugin.ini
    • plugin.php

Use Case Steps

1. Create a plugin.ini file with the following text:

[info]
name="Filter Admin Nav"
author="Plugin Developer"
description="Adds a link to CHNM's homepage on the nav of administrative panel."
omeka_minimum_version="1.0"
omeka_tested_up_to="1.1"
version="1.0"
tags="admin, customization"

2. You'll need to create a plugin.php file within your plugin that will run the filter.

The Plugin_API/Filter/admin_navigation_main filter allows a user to retrieve an array of all the navigation links and titles, and optionally manipulate that array. In the case of our plugin, we'll simply append our navigation to the end of the navigation array. Lastly, the example code returns the nav array so that the administrative theme can display the navigation.

Here's all the code in plugin.php:

<?php
// add filter for admin navigation main
add_filter('admin_navigation_main', 'filter_admin_nav_navigation');
 
// retrieve the array of navigation on the admin panel
function filter_admin_nav_navigation($navArray)
{
	// Append a link to CHNM's website to the array
	$navArray = $navArray + array('CHNM' => 'http://chnm.gmu.edu');
 
	// Return the navigation array, which will be formatted into an unordered list
	return $navArray;
}
?>

Suggestion

If you'd like your navigation text to link a URL that's within Omeka (such as the add a page to the admin theme use case), you should use the uri function instead of writing out the entire URL.