mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/PageImages
synced 2024-11-15 03:43:46 +00:00
Allow thumbnails to be provided in a different size
This will also be added to the interface, but first this implementation needs to be updated to already accept the optional new param. Doing it in different order would cause incompatible declaration warnings. Bug: T306883 Change-Id: Ia30afcc43a0ecec772cd0a82dd9661e61f31a651
This commit is contained in:
parent
3ab47c1061
commit
a8c8030299
|
@ -113,13 +113,14 @@ class SearchResultProvideThumbnailHookHandler implements SearchResultProvideThum
|
|||
/**
|
||||
* @param array $pageIdentities array that contain $pageId => SearchResultPageIdentity.
|
||||
* @param array &$results Placeholder for result. $pageId => SearchResultThumbnail
|
||||
* @param int|null $size size of thumbnail height and width in points
|
||||
*/
|
||||
public function onSearchResultProvideThumbnail( array $pageIdentities, &$results ): void {
|
||||
public function onSearchResultProvideThumbnail( array $pageIdentities, &$results, int $size = null ): void {
|
||||
$pageIdTitles = array_map( static function ( PageIdentity $identity ) {
|
||||
return Title::makeTitle( $identity->getNamespace(), $identity->getDBkey() );
|
||||
}, $pageIdentities );
|
||||
|
||||
$data = $this->getThumbnails( $pageIdTitles, self::THUMBNAIL_SIZE );
|
||||
$data = $this->getThumbnails( $pageIdTitles, $size ?? self::THUMBNAIL_SIZE );
|
||||
foreach ( $data as $pageId => $thumbnail ) {
|
||||
$results[ $pageId ] = $thumbnail;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue