jenkins-bot has submitted this change and it was merged. Change subject: Move the rest of hooks into the Hooks class ......................................................................
Move the rest of hooks into the Hooks class Change-Id: I70ab6aa3dd4051fd25248aaca8c059b9b9e461dc --- M extension.json M includes/Graph.body.php M includes/Graph.hooks.php 3 files changed, 32 insertions(+), 16 deletions(-) Approvals: Yurik: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index 34866da..620032e 100644 --- a/extension.json +++ b/extension.json @@ -165,10 +165,10 @@ }, "Hooks": { "ParserFirstCallInit": [ - "Graph\\Singleton::onParserFirstCallInit" + "Graph\\Hooks::onParserFirstCallInit" ], "ParserAfterParse": [ - "Graph\\Singleton::onParserAfterParse" + "Graph\\Hooks::onParserAfterParse" ], "ResourceLoaderTestModules": [ "Graph\\Hooks::onResourceLoaderTestModules" diff --git a/includes/Graph.body.php b/includes/Graph.body.php index 75ae23e..879eb33 100644 --- a/includes/Graph.body.php +++ b/includes/Graph.body.php @@ -16,29 +16,20 @@ use Parser; use ParserOptions; use ParserOutput; +use PPFrame; use Title; class Singleton { - - public static function onParserFirstCallInit( Parser $parser ) { - $parser->setHook( 'graph', 'Graph\Singleton::onGraphTag' ); - return true; - } - - public static function onParserAfterParse( Parser $parser ) { - self::finalizeParserOutput( $parser, $parser->getTitle(), $parser->getOutput() ); - return true; - } /** * @param $input * @param array $args * @param Parser $parser - * @param \PPFrame $frame + * @param PPFrame $frame * @return string */ - public static function onGraphTag( $input, array $args, Parser $parser, \PPFrame $frame ) { - return self::buildHtml( $input, $parser->getTitle(), $parser->getRevisionId(), + public static function onGraphTag( $input, array $args, Parser $parser, PPFrame $frame ) { + return Singleton::buildHtml( $input, $parser->getTitle(), $parser->getRevisionId(), $parser->getOutput(), $parser->getOptions()->getIsPreview(), $args ); } diff --git a/includes/Graph.hooks.php b/includes/Graph.hooks.php index 1b0e3c3..27cecda 100644 --- a/includes/Graph.hooks.php +++ b/includes/Graph.hooks.php @@ -8,11 +8,13 @@ namespace Graph; +use Parser; use ResourceLoader; class Hooks { /** - * Conditionally register the unit testing module for the ext.graph.visualEditor module + * ResourceLoaderTestModules hook handler. + * Conditionally registers the unit testing module for the ext.graph.visualEditor module * only if that module is loaded * * @param array $testModules The array of registered test modules @@ -42,4 +44,27 @@ return true; } + + /** + * ParserFirstCallInit hook handler. + * Registers the <graph> tag + * + * @param Parser $parser + * @return bool + */ + public static function onParserFirstCallInit( Parser $parser ) { + $parser->setHook( 'graph', 'Graph\Singleton::onGraphTag' ); + return true; + } + + /** + * ParserAfterParse hook handler. + * + * @param Parser $parser + * @return bool + */ + public static function onParserAfterParse( Parser $parser ) { + Singleton::finalizeParserOutput( $parser, $parser->getTitle(), $parser->getOutput() ); + return true; + } } -- To view, visit https://gerrit.wikimedia.org/r/315840 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I70ab6aa3dd4051fd25248aaca8c059b9b9e461dc Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Graph Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Yurik <yu...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits