Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
CollapsibleFieldsetLayout
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\HTMLForm;
4
5/*
6 * @stable to extend
7 */
8class CollapsibleFieldsetLayout extends \OOUI\FieldsetLayout {
9    /**
10     * @stable to call
11     * @inheritDoc
12     */
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
40/** @deprecated class alias since 1.42 */
41class_alias( CollapsibleFieldsetLayout::class, 'CollapsibleFieldsetLayout' );