Closed krabina closed 1 year ago
Yeah, such a behaviour switch could be useful on selected pages. Thanks for suggesting.
something like
__NOSUMMARYCARDS__
Using a magic word, one would need to use OutputPageParserOutput
instead of the BeforePageDisplay
hook.
(code is untested and requires to register __NOSUMMARYCARDS__
)
$this->handlers['OutputPageParserOutput'] = function ( &$outputPage, $parserOutput ) {
$mw = \MagicWord::get( 'NO_SUMMARYCARDS' );
// If the text does not contain __NOSUMMARYCARDS__ then register the modules
if ( !$mw->matchAndRemove( $parserOutput->getText() ) ) {
$outputPage->addModuleStyles( 'ext.summary.cards.styles' );
$outputPage->addModules(
array(
'ext.summary.cards'
)
);
}
return true;
};
We would also need a "SummaryCards.magic.php" file to be able to localize __NOSUMMARYCARDS__
.
It would be great to have an opportunity to omit the SummaryCard function on certain pages, e. g. with something like
__NOSUMMARYCARDS__