Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CollectionTreePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
*/
class CollectionTreePlugin extends Omeka_Plugin_AbstractPlugin
{
/**
* @var array Hooks for the plugin.
*/
protected $_hooks = array(
'install',
'uninstall',
Expand All @@ -28,10 +31,14 @@ class CollectionTreePlugin extends Omeka_Plugin_AbstractPlugin
'public_collections_show',
);

/**
* @var array Filters for the plugin.
*/
protected $_filters = array(
'admin_navigation_main',
'public_navigation_main',
'admin_collections_form_tabs',
'collections_select_options',
);

/**
Expand Down Expand Up @@ -285,4 +292,17 @@ public function filterAdminCollectionsFormTabs($tabs, $args)
);
return $tabs;
}

/**
* Manage search options for collections.
*
* @param array Search options for collections.
* @return array Filtered search options for collections.
*/
public function filterCollectionsSelectOptions($options)
{
$treeOptions = $this->_db->getTable('CollectionTree')->findPairsForSelectForm();
// Keep only chosen collections, in case another filter removed some.
return array_intersect_key($treeOptions, $options);
}
}