jenkins-bot has submitted this change and it was merged.
Change subject: New hook, AfterParserFetchFileAndTitle
......................................................................
New hook, AfterParserFetchFileAndTitle
It is needed for PageImages to collect information about galleries, improving
results
for Commons mainspace.
Bug: 66510
Change-Id: I3136d648ef2c1841767db0ab33855cd168e3de3e
---
M docs/hooks.txt
M includes/gallery/ImageGalleryBase.php
M includes/parser/Parser.php
3 files changed, 16 insertions(+), 0 deletions(-)
Approvals:
Kaldari: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 1673f06..b1ef47c 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -326,6 +326,13 @@
$sRevCount: Number of successfully imported revisions
$pageInfo: associative array of page information
+'AfterParserFetchFileAndTitle': After an image gallery is formed by Parser,
+just before adding its HTML to parser output.
+$parser: Parser object that called the hook
+$ig: Gallery, an object of one of the gallery classes (inheriting from
+ImageGalleryBase)
+$html: HTML generated by the gallery
+
'AjaxAddScript': Called in output page just before the initialisation
of the javascript ajax engine. The hook is only called when ajax
is enabled ( $wgUseAjax = true; ).
diff --git a/includes/gallery/ImageGalleryBase.php
b/includes/gallery/ImageGalleryBase.php
index 8d2b949..837a731 100644
--- a/includes/gallery/ImageGalleryBase.php
+++ b/includes/gallery/ImageGalleryBase.php
@@ -259,6 +259,14 @@
}
/**
+ * Returns the list of images this gallery contains
+ * @return array
+ */
+ public function getImages() {
+ return $this->mImages;
+ }
+
+ /**
* isEmpty() returns true if the gallery contains no images
* @return bool
*/
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index eb7bd1b..89ed60d 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -5369,6 +5369,7 @@
$ig->add( $title, $label, $alt, $link, $handlerOptions
);
}
$html = $ig->toHTML();
+ wfRunHooks( 'AfterParserFetchFileAndTitle', array( $this, $ig,
&$html ) );
wfProfileOut( __METHOD__ );
return $html;
}
--
To view, visit https://gerrit.wikimedia.org/r/140256
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3136d648ef2c1841767db0ab33855cd168e3de3e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits