/** * Initialize the tests handler * * @param DataContainer|null $dc */ public function initialize(DataContainer $dc = null) { if (CURRENT_ID) { $archive = Database::getInstance()->prepare("SELECT seo_serp_ignore FROM tl_news_archive WHERE id=?")->limit(1)->execute(CURRENT_ID); // Do not initialize handler if archive is ignored if ($archive->seo_serp_ignore) { unset($GLOBALS['TL_DCA']['tl_news']['fields']['seo_serp_preview']); return; } } parent::initialize($dc); }
/** * Redirect the user to given module * * @param string $target */ protected function redirectToModule($target) { list($module, $params) = trimsplit('|', $target); $modules = $this->getModules(); if (!isset($modules[$module])) { return; } $session = Session::getInstance()->getData(); // Set the filters of all module tables to show all message types foreach ($modules[$module]['tables'] as $table) { $session['filter'][$table][AbstractHandler::$filterName] = AbstractHandler::getAvailableFilters()[0]; } // Decode the params if ($params) { $params = '&' . base64_decode($params); } Session::getInstance()->setData($session); Controller::redirect('contao/main.php?do=' . $module . $params . '&' . AbstractHandler::$serpTemporaryParamName . '=1'); }
/** * Get the global operation * * @param bool $enabled * * @return array */ protected function getGlobalOperation($enabled) { $operation = parent::getGlobalOperation($enabled); if ($enabled) { $operation['href'] .= '&serp_tests_expand=1'; } return $operation; }