DynamicPageList3/includes/Lister/InlineList.php

85 lines
1.3 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\Parameters;
2021-10-01 22:52:30 +00:00
use Parser;
2020-11-22 20:03:02 +00:00
class InlineList 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_INLINE;
/**
* Heading Start
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $headingStart = '';
/**
* Heading End
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $headingEnd = '';
/**
* List(Section) Start
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $listStart = '<div%s>';
/**
* List(Section) End
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $listEnd = '</div>';
/**
* Item Start
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $itemStart = '<span%s>';
/**
* Item End
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
public $itemEnd = '</span>';
/**
* Inline item text separator.
*
2021-02-22 23:48:01 +00:00
* @var string
2020-11-22 20:03:02 +00:00
*/
protected $textSeparator = '';
/**
2021-10-01 22:52:30 +00:00
* @param Parameters $parameters
* @param Parser $parser
2020-11-22 20:03:02 +00:00
*/
2021-10-01 22:52:30 +00:00
public function __construct( Parameters $parameters, Parser $parser ) {
2021-02-22 23:48:01 +00:00
parent::__construct( $parameters, $parser );
2021-10-01 22:52:30 +00:00
2021-02-22 23:48:01 +00:00
$this->textSeparator = $parameters->getParameter( 'inlinetext' );
2020-11-22 20:03:02 +00:00
}
/**
* Join together items after being processed by formatItem().
*
2021-10-01 22:52:30 +00:00
* @param array $items
* @return string
2020-11-22 20:03:02 +00:00
*/
2021-02-22 23:48:01 +00:00
protected function implodeItems( $items ) {
return implode( $this->textSeparator, $items );
2020-11-22 20:03:02 +00:00
}
}