protected function prepareFrontendFilterOptions($arrWidget, $arrFilterUrl, $arrJumpTo, $blnAutoSubmit)
{
$arrOptions = array();
if (!isset($arrWidget['options'])) {
return $arrOptions;
}
$dispatcher = $this->getEventDispatcher();
$strFilterAction = $this->buildFilterUrl($arrFilterUrl, $arrWidget['eval']['urlparam']);
// If no jumpTo-page has been provided, we use the current page.
if (!$arrJumpTo) {
$arrJumpTo = $GLOBALS['objPage']->row();
}
if ($arrWidget['eval']['includeBlankOption']) {
$blnActive = $this->isActiveFrontendFilterValue($arrWidget, $arrFilterUrl, '');
$event = new GenerateFrontendUrlEvent($arrJumpTo, sprintf($strFilterAction, ''));
$dispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
$arrOptions[] = array('key' => '', 'value' => $arrWidget['eval']['blankOptionLabel'] ? $arrWidget['eval']['blankOptionLabel'] : $GLOBALS['TL_LANG']['metamodels_frontendfilter']['do_not_filter'], 'href' => $event->getUrl(), 'active' => $blnActive, 'class' => 'doNotFilter' . ($blnActive ? ' active' : ''));
}
foreach ($arrWidget['options'] as $strKeyOption => $strOption) {
$strValue = rawurlencode($this->getFrontendFilterValue($arrWidget, $arrFilterUrl, $strKeyOption));
$blnActive = $this->isActiveFrontendFilterValue($arrWidget, $arrFilterUrl, $strKeyOption);
if (!empty($strValue)) {
if ($arrWidget['eval']['urlparam'] !== 'auto_item') {
$strValue = '/' . $arrWidget['eval']['urlparam'] . '/' . $strValue;
} else {
$strValue = '/' . $strValue;
}
}
$event = new GenerateFrontendUrlEvent($arrJumpTo, sprintf($strFilterAction, $strValue), null, true);
$dispatcher->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
$arrOptions[] = array('key' => $strKeyOption, 'value' => $strOption, 'href' => $event->getUrl(), 'active' => $blnActive, 'class' => standardize($strKeyOption) . ($blnActive ? ' active' : ''));
}
return $arrOptions;
}