New hook, AfterParserFetchFileAndTitle
It is needed for PageImages to collect information about galleries, improving results for Commons mainspace. Bug: 66510 Change-Id: I3136d648ef2c1841767db0ab33855cd168e3de3e
This commit is contained in:
parent
460213619e
commit
467f4affd1
3 changed files with 16 additions and 0 deletions
|
|
@ -326,6 +326,13 @@ $revCount: Number of revisions in the XML file
|
|||
$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; ).
|
||||
|
|
|
|||
|
|
@ -258,6 +258,14 @@ abstract class ImageGalleryBase extends ContextSource {
|
|||
array_unshift( $this->mImages, array( &$title, $html, $alt, $link, $handlerOpts ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -5369,6 +5369,7 @@ class Parser {
|
|||
$ig->add( $title, $label, $alt, $link, $handlerOptions );
|
||||
}
|
||||
$html = $ig->toHTML();
|
||||
wfRunHooks( 'AfterParserFetchFileAndTitle', array( $this, $ig, &$html ) );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $html;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue