/** * Initialize the tests handler * * @param DataContainer|null $dc */ public function initialize(DataContainer $dc = null) { $pages = Database::getInstance()->prepare("SELECT id FROM tl_page WHERE type='root' AND seo_serp_ignore=''")->limit(1)->execute(); // Do not initialize handler if there are no pages to analyze if (!$pages->numRows) { unset($GLOBALS['TL_DCA']['tl_page']['fields']['seo_serp_preview']); return; } parent::initialize($dc); }
/** * 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); }