Placement of Item Relations in Item Show Page

I have added the Item Relations plugin and would like to have it display in the sidebar on my item show page. I am finding that my Social Bookmarking and Item Relations plugins both seem to be pulled by this line:

<?php fire_plugin_hook('public_items_show', array('view' => $this, 'item' => $item)); ?>

I originally moved this piece of code to the primary div when it was just the Social Bookmarking plugin displayed. Now, I would like to tease the two apart and have the Item Relations display on the sidebar. Is this possible? Here is a link to a specific item that shows the display at the bottom of the primary div.

Thanks for any help

My first thought would be to just style the toolbar directly into your page without the plugin, you also will have access to your analytics via your account (without hacking the plugin).

It's a little verbose, but if you are editing your theme you and specify the plugins' content with get_specific_plugin_hook_output()

fire_plugin_hook() rolls through all of the plugins that have registered a hook, but get_specific_plugin_hook_output() lets you get the content one at a time.

So, for your case, it looks like doing

echo get_specific_plugin_hook_output('ItemRelations', 'public_items_show', array('view' => $this, 'item' => $item));

will do the trick for showing the content from the Item Relations plugin whereever you want it. You'd want to then remove fire_plugin_hook() and replace it with the specific calls for each of the plugins you have installed for the rest of them.

Perfection, thanks!

Almost there. Is it possible to have the Item Relations displayed only when there is a relation?

OH! How quickly 'perfection' moves into 'almost there' when you are hacking away at things!

Here's the changes I made in ItemRelationsPlugin.php that I think will get at it:

public function hookPublicItemsShow() {
        if (get_option('item_relations_public_append_to_items_show')) {
            $item = get_current_record('item');
            $objRelations = self::prepareObjectRelations($item);
            $sbjRelations = self::prepareSubjectRelations($item);

            if (empty($objRelations) && empty($sbjRelations)) {
            echo common('item-relations-show', array(
                'subjectRelations' => self::prepareSubjectRelations($item),
                'objectRelations' => self::prepareObjectRelations($item)


Ah, sorry to be dragging you down my slippery slope. I'm new to php and was registered for the Under the Hood session at THATCamp in Boston but car trouble intervened. Much appreciation for your patience with my mucking around. This solved the empty element problem. Thanks!

No worries about the slippery slope -- it's the nature of the beast! Good luck!

Thank you all for this quite useful topic. I just wonder whether there is an 'offical' omeka-way of displaying only a particular kind or type of an item relation based on the relation type specified in 'label' in the table omeka_item_relations_properties. I finally want to have a nice grouped output of all relations that are for instance speficifed by "citedBy." I could not yet figure out whether this is possible without modifying the ItemRelations-Plugin, or whether there is any prepared hook for it.

Many thanks for any suggestions!

There's not a direct way, but you could write a function that would do it.

You'd first dig up the id of the property you need with something like:

$db = get_db();
$properties = $db->getTable('ItemRelationsProperty')->findByLabel('cited by');
$property = $properties[0];
$propertyId = $property->id;

Then you'd use that to write a query on the ItemReleationsRelation table:

$relationTable = $db->getTable('ItemRelationsRelation');
$select = $relationTable->getSelect();
$select->where('item_relations_relations.subject_item_id = ?', (int) $subjectItemId);
$select->where('item_relations_relations.property_id = ?', (int) $propertyId);

$relatedItems = $relationTable->fetchObjects($select);

I haven't tried this, but I think it's on the right track.