diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php b/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php index 808cd3d9d65e7bfc43d02c9e799cf00e2adb5fb9..3fd1522591131cce5801781070a54346c5861148 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/SortFacetList.php @@ -26,6 +26,8 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki/building_a_recommendations_module Wiki */ +namespace VuFind\Theme\Root\Helper; +use Zend\View\Helper\AbstractHelper; /** * Sort facet list view helper @@ -36,27 +38,28 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org/wiki/building_a_recommendations_module Wiki */ -class VuFind_Theme_Root_Helper_SortFacetList extends Zend_View_Helper_Abstract +class SortFacetList extends AbstractHelper { /** * Turns facet information into an alphabetical list. * - * @param VF_Search_Base_Results $results Search result object - * @param string $field Facet field to sort - * @param array $list Facet value list extract from the - * search result object's getFacetList method - * @param array $urlSettings Options to use to generate search - * URLs for individual facet values + * @param \VuFind\Search\Base\Results $results Search result object + * @param string $field Facet field to sort + * @param array $list Facet value list extract from + * the search result object's getFacetList method + * @param array $searchRoute Route to use to generate + * search URLs for individual facet values * * @return array Associative URL => description array sorted by description */ - public function sortFacetList($results, $field, $list, $urlSettings) + public function __invoke($results, $field, $list, $searchRoute) { $facets = array(); $results->setLimit($results->getDefaultLimit()); // avoid limit on URL + $urlHelper = $this->getView()->plugin('url'); foreach ($list as $value) { - $url = $this->view->url($urlSettings, 'default', true) . - $results->getUrl()->addFacet($field, $value['value']); + $url = $urlHelper($searchRoute) + . $results->getUrl()->addFacet($field, $value['value']); $facets[$url] = $value['displayText']; } natcasesort($facets); diff --git a/themes/root/theme.ini b/themes/root/theme.ini index 58af66c089b16b6895aa37052b6efa6849dce308..dcd94e0bb2ba334c361e6ee923ea6b2a9dac3b30 100644 --- a/themes/root/theme.ini +++ b/themes/root/theme.ini @@ -10,6 +10,7 @@ helpers_to_register[] = "ImageLink" helpers_to_register[] = "MobileUrl" helpers_to_register[] = "OfflineMode" helpers_to_register[] = "SearchOptions" +helpers_to_register[] = "SortFacetList" helpers_to_register[] = "SystemEmail" helpers_to_register[] = "TransEsc" helpers_to_register[] = "Translate"