MediaWiki
REL1_41
SpinnerWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget
;
4
14
class
SpinnerWidget
{
15
16
private
$attributes;
17
private
$content;
18
22
public
function
__construct
( array $config = [] ) {
23
$size = $config[
'size'
] ??
'small'
;
24
$type = $config[
'type'
] ??
'inline'
;
25
26
$this->attributes = [];
27
28
if
( isset( $config[
'id'
] ) ) {
29
$this->attributes[
'id'
] = $config[
'id'
];
30
}
31
32
// Initialization
33
$this->attributes[
'class'
] = [
34
'mw-spinner'
,
35
$size ===
'small'
?
'mw-spinner-small'
:
'mw-spinner-large'
,
36
$type ===
'inline'
?
'mw-spinner-inline'
:
'mw-spinner-block'
,
37
];
38
39
$this->content =
40
'<div class="mw-spinner-container">'
.
41
str_repeat(
'<div></div>'
, 12 ) .
42
'</div>'
;
43
}
44
49
public
function
toString
() {
50
return \MediaWiki\Html\Html::rawElement(
'div'
, $this->attributes, $this->content );
51
}
52
60
public
function
__toString
() {
61
try
{
62
return
$this->
toString
();
63
}
catch
( \Exception $ex ) {
64
trigger_error( (
string
)$ex, E_USER_ERROR );
65
}
66
}
67
}
MediaWiki\Widget\SpinnerWidget
PHP version of jquery.spinner.
Definition
SpinnerWidget.php:14
MediaWiki\Widget\SpinnerWidget\__construct
__construct(array $config=[])
Definition
SpinnerWidget.php:22
MediaWiki\Widget\SpinnerWidget\toString
toString()
Render element into HTML.
Definition
SpinnerWidget.php:49
MediaWiki\Widget\SpinnerWidget\__toString
__toString()
Magic method implementation.
Definition
SpinnerWidget.php:60
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
widget
SpinnerWidget.php
Generated on Wed Nov 27 2024 07:26:03 for MediaWiki by
1.10.0