X-Git-Url: http://git.cyclocoop.org/%24self?a=blobdiff_plain;f=includes%2FOutputPage.php;h=7f0454f6bf49ecaa6cfea6a39a7f937065580b20;hb=8cabb5f7778574aa723e5615b27a3f5ac104c48d;hp=6a1ce192bb10a40f8516c1b3e316a32c61160d0f;hpb=0988d1200dd5d67719baf076cdbe3e363801ac23;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 6a1ce192bb..7f0454f6bf 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -255,6 +255,11 @@ class OutputPage extends ContextSource { */ private $mTarget = null; + /** + * @var bool: Whether output should contain table of contents + */ + private $mEnableTOC = true; + /** * Constructor for OutputPage. This should not be called directly. * Instead a new RequestContext should be created and it will implicitly create @@ -1606,6 +1611,7 @@ class OutputPage extends ContextSource { */ function addParserOutput( &$parserOutput ) { $this->addParserOutputNoText( $parserOutput ); + $parserOutput->setTOCEnabled( $this->mEnableTOC ); $text = $parserOutput->getText(); wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); $this->addHTML( $text ); @@ -3648,4 +3654,20 @@ $templates return array(); } + /** + * Enables/disables TOC, doesn't override __NOTOC__ + * @param bool $flag + * @since 1.22 + */ + public function enableTOC( $flag = true ) { + $this->mEnableTOC = $flag; + } + + /** + * @return bool + * @since 1.22 + */ + public function isTOCEnabled() { + return $this->mEnableTOC; + } }