MediaWiki REL1_30
ListToggle.php
Go to the documentation of this file.
1<?php
33 private $output;
34
35 public function __construct( OutputPage $output ) {
36 $this->output = $output;
37
38 $output->addModules( 'mediawiki.checkboxtoggle' );
39 $output->addModuleStyles( 'mediawiki.checkboxtoggle.styles' );
40 }
41
42 private function checkboxLink( $checkboxType ) {
43 return Html::element(
44 // CSS classes: mw-checkbox-all, mw-checkbox-none, mw-checkbox-invert
45 'a', [ 'class' => 'mw-checkbox-' . $checkboxType, 'role' => 'button', 'tabindex' => 0 ],
46 $this->output->msg( 'checkbox-' . $checkboxType )->text()
47 );
48 }
49
53 public function getHTML() {
54 // Select: All, None, Invert
55 $links = [
56 $this->checkboxLink( 'all' ),
57 $this->checkboxLink( 'none' ),
58 $this->checkboxLink( 'invert' ),
59 ];
60
61 return Html::rawElement( 'div',
62 [
63 'class' => 'mw-checkbox-toggle-controls'
64 ],
65 $this->output->msg( 'checkbox-select' )
66 ->rawParams( $this->output->getLanguage()->commaList( $links ) )->escaped()
67 );
68 }
69}
Class for generating clickable toggle links for a list of checkboxes.
__construct(OutputPage $output)
OutputPage $output
checkboxLink( $checkboxType)
This class should be covered by a general architecture document which does not exist as of January 20...
addModuleStyles( $modules)
Add only CSS of one or more modules recognized by ResourceLoader.
addModules( $modules)
Add one or more modules recognized by ResourceLoader.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful