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