diff options
Diffstat (limited to 'includes/OutputPage.php')
-rw-r--r-- | includes/OutputPage.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 9cba0cce8705..854290477e5f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -257,11 +257,16 @@ class OutputPage extends ContextSource { private $mTarget = null; /** - * @var bool: Whether output should contain table of contents + * @var bool: Whether parser output should contain table of contents */ private $mEnableTOC = true; /** + * @var bool: Whether parser output should contain section edit links + */ + private $mEnableSectionEditLinks = true; + + /** * Constructor for OutputPage. This should not be called directly. * Instead a new RequestContext should be created and it will implicitly create * a OutputPage tied to that context. @@ -1613,6 +1618,11 @@ class OutputPage extends ContextSource { function addParserOutput( &$parserOutput ) { $this->addParserOutputNoText( $parserOutput ); $parserOutput->setTOCEnabled( $this->mEnableTOC ); + + // Touch section edit links only if not previously disabled + if ( $parserOutput->getEditSectionTokens() ) { + $parserOutput->setEditSectionTokens( $this->mEnableSectionEditLinks ); + } $text = $parserOutput->getText(); wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) ); $this->addHTML( $text ); @@ -3691,4 +3701,21 @@ $templates public function isTOCEnabled() { return $this->mEnableTOC; } + + /** + * Enables/disables section edit links, doesn't override __NOEDITSECTION__ + * @param bool $flag + * @since 1.23 + */ + public function enableSectionEditLinks( $flag = true ) { + $this->mEnableSectionEditLinks = $flag; + } + + /** + * @return bool + * @since 1.23 + */ + public function sectionEditLinksEnabled() { + return $this->mEnableSectionEditLinks; + } } |