Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1432387
ToggleWidget.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ToggleWidget.php
View Options
<?php
namespace
OOUI
;
/**
* Toggle widget.
*/
class
ToggleWidget
extends
Widget
{
use
TitledElement
;
/**
* Defines the value of the widget
*
* @var bool
*/
protected
$value
;
public
function
__construct
(
array
$config
=
[]
)
{
parent
::
__construct
(
$config
);
// Traits
$this
->
initializeTitledElement
(
$config
);
$this
->
addClasses
(
[
'oo-ui-toggleWidget'
]
);
$this
->
setValue
(
$config
[
'value'
]
??
false
);
}
/** @inheritDoc */
public
function
getConfig
(
&
$config
)
{
$config
[
'value'
]
=
$this
->
value
;
return
parent
::
getConfig
(
$config
);
}
/**
* Get value representing toggle state.
*
* @return bool value The on/off state
*/
public
function
getValue
()
{
return
$this
->
value
;
}
/**
* Set the value of the widget
*
* @param bool|null $value Widget
* @return $this
*/
public
function
setValue
(
$value
=
null
)
{
$this
->
value
=
(
bool
)
$value
;
$this
->
toggleClasses
(
[
'oo-ui-toggleWidget-on'
],
$this
->
value
);
$this
->
toggleClasses
(
[
'oo-ui-toggleWidget-off'
],
!
$this
->
value
);
return
$this
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 21:42 (1 d, 9 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
cb/3e/cdbdd3c5e355068faa60c39d436b
Default Alt Text
ToggleWidget.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment