Overriding "Search By Metadata Plugin"

Hi.

I am using the Search By Metadata Plugin to create clickable links for particular metadata items. Everything is working as it should.

The problem I'm having right now is that in one section of the interface, I need to echo a simple value of a metadata item — rather than a link — but I don't know how to do that since the Search By Metadata Plugin hijacks all instances of this metadata item and spits out the full-blown link.

Do you have any tips on how I could approach this problem? How can I use the plugin in certain situations, but revert to plain metadata values in others?

All best,
Toma

It'll depend a bit on what exactly the section of the interface is. But one approach would be to add this at the top of the link() method in SearchByMetadataPlugin.php

$request = Zend_Controller_Front::getInstance()->getRequest();
$params = $request->getParams();

Then, the $params is an array giving information about the route being used. For example, you are on the public items show page for item 4851, the array will be:

Array
(
    [controller] => items
    [action] => show
    [id] => 4851
)

If the distinction for the section you need can match up to a controller and action -- which usually correspond nicely to the url, e.g. items/show/4851 -- you could use those values to test whether to return the link or the plain text in that case.

If it's just a call to metadata, you can use the no_filter option.

Excellent!
Many thanks to both.
All best,
Toma