Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Feature request: __NOSUMMARYCARDS__ #8

Closed
krabina opened this issue Oct 6, 2016 · 4 comments
Closed

Feature request: __NOSUMMARYCARDS__ #8

krabina opened this issue Oct 6, 2016 · 4 comments

Comments

@krabina
Copy link
Contributor

krabina commented Oct 6, 2016

It would be great to have an opportunity to omit the SummaryCard function on certain pages, e. g. with something like __NOSUMMARYCARDS__

@kghbln
Copy link
Member

kghbln commented Oct 6, 2016

Yeah, such a behaviour switch could be useful on selected pages. Thanks for suggesting.

@mwjames
Copy link
Contributor

mwjames commented Oct 9, 2016

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;
};

@kghbln
Copy link
Member

kghbln commented May 26, 2017

We would also need a "SummaryCards.magic.php" file to be able to localize __NOSUMMARYCARDS__.

@kghbln
Copy link
Member

kghbln commented Oct 9, 2023

Closed per #17

@kghbln kghbln closed this as completed Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants