MediaWiki master
CollapsibleFieldsetLayout.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\HTMLForm;
4
5/*
6 * @stable to extend
7 */
8class CollapsibleFieldsetLayout extends \OOUI\FieldsetLayout {
13 public function __construct( array $config = [] ) {
14 parent::__construct( $config );
15
16 $this->addClasses( [ 'mw-collapsibleFieldsetLayout', 'mw-collapsible' ] );
17 if ( $config['collapsed'] ?? false ) {
18 $this->addClasses( [ 'mw-collapsed' ] );
19 }
20 $this->header->addClasses( [ 'mw-collapsible-toggle' ] );
21 $this->group->addClasses( [ 'mw-collapsible-content' ] );
22
23 $this->header->appendContent(
24 new \OOUI\IconWidget( [
25 'icon' => 'expand',
26 'label' => wfMessage( 'collapsible-expand' )->text(),
27 ] ),
28 new \OOUI\IconWidget( [
29 'icon' => 'collapse',
30 'label' => wfMessage( 'collapsible-collapse' )->text(),
31 ] )
32 );
33
34 $this->header->setAttributes( [
35 'role' => 'button',
36 ] );
37 }
38}
39
41class_alias( CollapsibleFieldsetLayout::class, 'CollapsibleFieldsetLayout' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.