Skip to content

Commit

Permalink
don't make dc title into links on browse pages
Browse files Browse the repository at this point in the history
This creates a link that just goes right back to the browse page from the browse page.

fixes OMEKA-1143
  • Loading branch information
patrickmj committed Mar 20, 2015
1 parent 8f59244 commit 558f2d9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion SearchByMetadataPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ public function setUp()
if(is_array($linkedElements)){
foreach($linkedElements as $elementSet=>$elements) {
foreach($elements as $element) {
add_filter(array('Display', 'Item', $elementSet, $element), array($this, 'link'));
//don't add links on DC:Title if on browse pages,
//as this creates links right back to the browse page search
//need to punt to a special filter, since Request doesn't exist here
if ($elementSet == 'Dublin Core'
&& $element == 'Title') {
add_filter(array('Display', 'Item', $elementSet, $element), array($this, 'linkDcTitle'));
} else {
add_filter(array('Display', 'Item', $elementSet, $element), array($this, 'link'));
}

}
}
}
Expand Down Expand Up @@ -53,6 +62,16 @@ public function hookConfigForm()
include('config_form.php');
}

public function linkDcTitle($text, $args)
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$action = $request->getActionName();
if ($action != 'browse') {
return $this->link($text, $args);
}
return $text;
}

public function link($text, $args)//$record, $elementText)
{

Expand Down

0 comments on commit 558f2d9

Please sign in to comment.