mirror of
https://github.com/StarCitizenTools/mediawiki-extensions-TabberNeue.git
synced 2024-11-23 16:06:45 +00:00
feat: allow id and class attributes to be set on Tabber
Closes: #183, #193 Co-Authored-By: Thomas-programmiert <Thomas-programmiert@users.noreply.github.com>
This commit is contained in:
parent
0e136945cc
commit
d5f9e03d47
|
@ -56,7 +56,7 @@ class Tabber {
|
|||
|
||||
$count = count( $parserOutput->getExtensionData( 'tabber-count' ) ?? [] );
|
||||
|
||||
$html = self::render( $input, $count, $parser, $frame );
|
||||
$html = self::render( $input, $count, $args, $parser, $frame );
|
||||
|
||||
$parserOutput->appendExtensionData( 'tabber-count', ++$count );
|
||||
|
||||
|
@ -72,15 +72,17 @@ class Tabber {
|
|||
*
|
||||
* @param string $input The input URL between the beginning and ending tags.
|
||||
* @param int $count Current Tabber count
|
||||
* @param array $args
|
||||
* @param Parser $parser Mediawiki Parser Object
|
||||
* @param PPFrame $frame Mediawiki PPFrame Object
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public static function render( string $input, int $count, Parser $parser, PPFrame $frame ): string {
|
||||
public static function render( string $input, int $count, array $args = [], Parser $parser, PPFrame $frame ): string {
|
||||
$arr = explode( '|-|', $input );
|
||||
$data = [
|
||||
'count' => $count,
|
||||
'id' => isset( $args['id'] ) ? $args['id'] : "tabber-$count",
|
||||
'class' => isset( $args['class'] ) ? $args['class'] : '',
|
||||
'array-tabs' => []
|
||||
];
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class TabberTransclude {
|
|||
|
||||
$count = count( $parserOutput->getExtensionData( 'tabber-count' ) ?? [] );
|
||||
|
||||
$html = self::render( $input, $count, $parser, $frame );
|
||||
$html = self::render( $input, $count, $args, $parser, $frame );
|
||||
|
||||
$parser->getOutput()->addModuleStyles( [ 'ext.tabberNeue.init.styles' ] );
|
||||
$parser->getOutput()->addModules( [ 'ext.tabberNeue' ] );
|
||||
|
@ -63,16 +63,18 @@ class TabberTransclude {
|
|||
*
|
||||
* @param string $input The input URL between the beginning and ending tags.
|
||||
* @param int $count Current Tabber count
|
||||
* @param array $args
|
||||
* @param Parser $parser Mediawiki Parser Object
|
||||
* @param PPFrame $frame Mediawiki PPFrame Object
|
||||
*
|
||||
* @return string HTML
|
||||
*/
|
||||
public static function render( string $input, int $count, Parser $parser, PPFrame $frame ): string {
|
||||
public static function render( string $input, int $count, array $args = [], Parser $parser, PPFrame $frame ): string {
|
||||
$selected = true;
|
||||
$arr = explode( "\n", $input );
|
||||
$data = [
|
||||
'count' => $count,
|
||||
'id' => isset( $args['id'] ) ? $args['id'] : "tabber-$count",
|
||||
'class' => isset( $args['class'] ) ? $args['class'] : '',
|
||||
'array-tabs' => []
|
||||
];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="tabber-{{count}}" class='tabber tabber--init'>{{!
|
||||
<div id="{{id}}" class='tabber tabber--init {{class}}'>{{!
|
||||
}}<header class="tabber__header">{{!
|
||||
}}<button class="tabber__header__prev" aria-hidden="true"></button>{{!
|
||||
}}<nav class="tabber__tabs" role="tablist">{{!
|
||||
|
|
Loading…
Reference in a new issue