/** * Get the filters */ protected function getFilters() { $strAction = ''; /** * @var IMetaModelFilterSettings */ $objFilterSetting = MetaModelFilterSettingsFactory::byId($this->objFilterConfig->metamodel_filtering); $objFrontendFilterOptions = new MetaModelFrontendFilterOptions(); $objFrontendFilterOptions->setAutoSubmit($this->objFilterConfig->metamodel_fef_autosubmit ? true : false); $objFrontendFilterOptions->setHideClearFilter($this->objFilterConfig->metamodel_fef_hideclearfilter ? true : false); $objFrontendFilterOptions->setShowCountValues($this->objFilterConfig->metamodel_available_values ? true : false); $arrJumpTo = $this->objFilterConfig->arrJumpTo; $arrParams = $this->getParams(); $arrWidgets = $objFilterSetting->getParameterFilterWidgets($arrParams['all'], $arrJumpTo, $objFrontendFilterOptions); // filter the widgets we do not want to show. $arrWanted = $this->getWantedNames(); // if we have POST data, we need to redirect now. if ($_POST && $this->Input->post('FORM_SUBMIT') == $this->formId) { $arrRedirectParams = $arrParams['other']; foreach ($arrWanted as $strWidget) { $arrFilter = $arrWidgets[$strWidget]; if (!empty($arrFilter['urlvalue'])) { $arrRedirectParams[$strWidget] = $arrFilter['urlvalue']; } } $this->redirectPost($arrRedirectParams); } $arrRendered = array(); // render the widgets through the filter templates. foreach ($this->getWantedNames() as $strWidget) { $arrFilter = $arrWidgets[$strWidget]; $strTemplate = $arrFilter['raw']['eval']['template']; // parse sub template $objSubTemplate = new FrontendTemplate($strTemplate ? $strTemplate : 'mm_filteritem_default'); $objSubTemplate->setData($arrFilter); $objSubTemplate->submit = $objFrontendFilterOptions->isAutoSubmit(); $arrFilter['value'] = $objSubTemplate->parse(); $arrRendered[$strWidget] = $arrFilter; } // return filter data return array('action' => $this->generateFrontendUrl($arrJumpTo, $this->getJumpToUrl($arrParams['other'])), 'formid' => $this->formId, 'filters' => $arrRendered, 'submit' => $objFrontendFilterOptions->isAutoSubmit() ? '' : $GLOBALS['TL_LANG']['metamodels_frontendfilter']['submit']); }