New hook ParserBeforeTranscludeTemplate:
authorDaniel Friesen <dantman@users.mediawiki.org>
Sat, 5 Jul 2008 03:36:12 +0000 (03:36 +0000)
committerDaniel Friesen <dantman@users.mediawiki.org>
Sat, 5 Jul 2008 03:36:12 +0000 (03:36 +0000)
This hook allows for modification of the title and text of a template which is being transcluded.

Use of this hook will allow extensions to create features such as TransWiki for an alternative to ScaryTransclusions.

RELEASE-NOTES
docs/hooks.txt
includes/parser/Parser.php

index c5d7544..cc231d9 100644 (file)
@@ -179,7 +179,10 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added blank special page Special:BlankPage for benchmarking, etc.
 * Foreign repo file descriptions and thumbnails are now cached.
 * (bug 11732) Allow localisation of edit button images
+* New hook ParserBeforeTranscludeTemplate to allow extensions to modify the text
+  and title of a template being transcluded in a way similar to how
+  ParserBeforeStrip effects the page being parsed
+
 === Bug fixes in 1.13 ===
 
 * (bug 10677) Add link to the file description page on the shared repository
index 6f76b5c..65802d6 100644 (file)
@@ -921,6 +921,12 @@ $parser: parser object
 $text: text being parsed
 $stripState: stripState used (object)
 
+'ParserBeforeTranscludeTemplate': Allows modification of the text and title of a
+  template which is being transcluded
+&$parser: parser object
+&$text: text being transcluded
+&$title: title object of the template
+
 'ParserBeforeTidy': called before tidy and custom tags replacements
 $parser: Parser object being used 
 $text: actual text
index f723525..4e6e564 100644 (file)
@@ -3039,6 +3039,8 @@ class Parser
                // Cache miss, go to the database
                list( $text, $title ) = $this->fetchTemplateAndTitle( $title );
 
+               wfRunHooks( 'ParserBeforeTranscludeTemplate', array( &$parser, &$text, &$title ) );
+
                if ( $text === false ) {
                        $this->mTplDomCache[$titleText] = false;
                        return array( false, $title );