Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
GlobalPreferencesFormOOUI
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 getBody
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace GlobalPreferences;
4
5use PreferencesFormOOUI;
6
7/**
8 * The GlobalPreferencesForm changes the display format, and adds section headers linking back to
9 * the local-preferences form.
10 *
11 * @package GlobalPreferences
12 */
13class GlobalPreferencesFormOOUI extends PreferencesFormOOUI {
14
15    /**
16     * Get the whole body of the form, adding the global preferences header text to the top of each
17     * section. JavaScript will later add the 'select all' checkbox to this header.
18     * @return string
19     */
20    public function getBody() {
21        // Add checkbox to the top of every section.
22        foreach ( $this->getPreferenceSections() as $section ) {
23            $colHeaderText = $this->getMessage( 'globalprefs-col-header' )->text();
24            $secHeader = new \OOUI\FieldLayout(
25                new \OOUI\CheckboxInputWidget( [
26                    'infusable' => true,
27                    'classes' => [ 'globalprefs-section-select-all' ],
28                ] ),
29                [
30                    'align' => 'inline',
31                    'label' => $colHeaderText,
32                    'classes' => [ 'globalprefs-section-header' ],
33                ]
34            );
35            $this->addHeaderHtml( $secHeader, $section );
36        }
37
38        return parent::getBody();
39    }
40
41}