Simple Vocab: Enable Linking

Is there a way to hack the Simple Vocab plugin so that it can become a live search instead of static text? In other words, in the Item display, a user could click on the name of the creator (controlled vocabulary entry) and get all other items with that same creator.

There is no way to hack the Simple Vocab plugin to filter display output. However, there is a way to do what you are asking by adding a filter to your theme's custom.php file. Something like the following:

add_filter(array('Display', 'Item', 'Dublin Core', 'Creator'), 'filter_creator_search');
function filter_creator_search($creator)
    if (empty($creator)) {
        return $creator;
    $creatorId = get_db()->getTable('Element')
                         ->findByElementSetNameAndElementName('Dublin Core', 'Creator')
    $url = uri('items/browse',
               array('advanced[0][element_id]' => $creatorId,
                     'advanced[0][type]' => 'contains',
                     'advanced[0][terms]' => $creator));
    return '<a href="'.$url.'">'.$creator.'</a>';

I hope this helps.


Thanks! The code mostly works. I ran into a problem with the Contribution plugin; searches on creator=Anonymous gave 0 results. But that's pretty minor.