Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created March 23, 2011 15:13
Show Gist options
  • Save jeremyboggs/883259 to your computer and use it in GitHub Desktop.
Save jeremyboggs/883259 to your computer and use it in GitHub Desktop.
Function to move the tab of a specific element set to the top of the items form tab list.
<?php
/**
* Prepends the item form tabs with a specific element set.
*
* @param array The item form tabs. These will get filtered.
* @return array A modified array of item form tabs.
*/
function custom_item_form_tab_order($tabs) {
// The name of our element set. What the link in the tab says.
$myTabName = 'Example Element Set';
/**
* We'll create a new array with our element set name and existing content
* to prepend to our $tabs array later.
*/
$myTab = array($myTabName => $tabs[$myTabName]);
// Remove our element set's existing tab.
unset($tabs[$myTabName]);
// Sets the tabs array to our new tab array plus the existing tab array.
$tabs = $myTab + $tabs;
// Return those sweet tabs.
return $tabs
}
/**
* Use our custom_item_form_tab_order function to filter the
* admin_items_form_tabs array.
*/
add_filter('admin_items_form_tabs', 'custom_item_form_tab_order');
@hvanstappen
Copy link

Hi,

I'm trying to add this to my Omeka instance, but just can't figure out where to put the
add_filter('admin_items_form_tabs', 'custom_item_form_tab_order');
line.

Any help would be appreciated.

PS using Omeka 2.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment