DynamicPageList3/includes/Lister/GalleryList.php

65 lines
1 KiB
PHP
Raw Normal View History

2020-11-22 20:03:02 +00:00
<?php
namespace MediaWiki\Extension\DynamicPageList3\Lister;
2020-11-22 20:03:02 +00:00
use MediaWiki\Extension\DynamicPageList3\Article;
2020-11-22 20:03:02 +00:00
class GalleryList extends Lister {
/**
* Listing style for this class.
*
2021-10-01 22:52:30 +00:00
* @var int
2020-11-22 20:03:02 +00:00
*/
public $style = parent::LIST_GALLERY;
/**
* List(Section) Start
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $listStart = '<gallery%s>';
/**
* List(Section) End
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $listEnd = '</gallery>';
/**
* Item Start
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $itemStart = "\n";
/**
* Item End
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
2021-10-01 22:52:30 +00:00
public $itemEnd = '|';
2020-11-22 20:03:02 +00:00
/**
* Format an item.
*
2021-10-01 22:52:30 +00:00
* @param Article $article
* @param string|null $pageText
* @return string
2020-11-22 20:03:02 +00:00
*/
2021-02-22 23:48:01 +00:00
public function formatItem( Article $article, $pageText = null ) {
2020-11-22 20:03:02 +00:00
$item = $article->mTitle;
2021-02-22 23:48:01 +00:00
if ( $pageText !== null ) {
2021-10-01 22:52:30 +00:00
// Include parsed/processed wiki markup content after each item before the closing tag.
2020-11-22 20:03:02 +00:00
$item .= $pageText;
}
$item = $this->getItemStart() . $item . $this->itemEnd;
2021-02-22 23:48:01 +00:00
$item = $this->replaceTagParameters( $item, $article );
2020-11-22 20:03:02 +00:00
return $item;
}
}