MetaModels\FrontendIntegration\HybridFilterBlock::getJumpTo PHP Method

getJumpTo() public method

Get the jump to page data.
public getJumpTo ( ) : array
return array
    public function getJumpTo()
    {
        if (!isset($this->arrJumpTo)) {
            /** @var \Database\Result $page */
            $page = $GLOBALS['objPage'];
            $this->setJumpTo($page->row());
            if ($this->metamodel_jumpTo) {
                // Page to jump to when filter submit.
                $objPage = $this->getServiceContainer()->getDatabase()->prepare('SELECT id, alias FROM tl_page WHERE id=?')->limit(1)->execute($this->metamodel_jumpTo);
                if ($objPage->numRows) {
                    $this->setJumpTo($objPage->row());
                }
            }
        }
        return $this->arrJumpTo;
    }

Usage Example

Example #1
0
 /**
  * Get the filters.
  *
  * @return array
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 protected function getFilters()
 {
     $filterOptions = $this->getFrontendFilterOptions();
     $jumpToInformation = $this->objFilterConfig->getJumpTo();
     $filterParameters = $this->getParams();
     $filterSetting = $this->objFilterConfig->getFilterCollection();
     $arrWidgets = $filterSetting->getParameterFilterWidgets($filterParameters['all'], $jumpToInformation, $filterOptions);
     // Filter the widgets we do not want to show.
     $wantedNames = $this->getWantedNames();
     $this->checkRedirect($arrWidgets, $wantedNames, $filterParameters);
     $renderedWidgets = array();
     // Render the widgets through the filter templates.
     foreach ($wantedNames as $strWidget) {
         $renderedWidgets[$strWidget] = $this->renderWidget($arrWidgets[$strWidget], $filterOptions);
     }
     $event = new GenerateFrontendUrlEvent($jumpToInformation, $this->getJumpToUrl($filterParameters['other']), null, true);
     $this->getDispatcher()->dispatch(ContaoEvents::CONTROLLER_GENERATE_FRONTEND_URL, $event);
     // Return filter data.
     return array('action' => $event->getUrl(), 'formid' => $this->formId, 'filters' => $renderedWidgets, 'submit' => $filterOptions->isAutoSubmit() ? '' : $GLOBALS['TL_LANG']['metamodels_frontendfilter']['submit']);
 }