MediaWiki
master
SpinnerWidget.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Widget
;
4
5
use Exception;
6
use
MediaWiki\Html\Html
;
7
17
class
SpinnerWidget
{
18
19
private
$attributes;
20
private
$content;
21
25
public
function
__construct
( array $config = [] ) {
26
$size = $config[
'size'
] ??
'small'
;
27
$type = $config[
'type'
] ??
'inline'
;
28
29
$this->attributes = [];
30
31
if
( isset( $config[
'id'
] ) ) {
32
$this->attributes[
'id'
] = $config[
'id'
];
33
}
34
35
// Initialization
36
$this->attributes[
'class'
] = [
37
'mw-spinner'
,
38
$size ===
'small'
?
'mw-spinner-small'
:
'mw-spinner-large'
,
39
$type ===
'inline'
?
'mw-spinner-inline'
:
'mw-spinner-block'
,
40
];
41
42
$this->content =
43
'<div class="mw-spinner-container">'
.
44
str_repeat(
'<div></div>'
, 12 ) .
45
'</div>'
;
46
}
47
52
public
function
toString
() {
53
return
Html::rawElement(
'div'
, $this->attributes, $this->content );
54
}
55
63
public
function
__toString
() {
64
try
{
65
return
$this->
toString
();
66
}
catch
( Exception $ex ) {
67
trigger_error( (
string
)$ex, E_USER_ERROR );
68
}
69
}
70
}
MediaWiki\Html\Html
This class is a collection of static functions that serve two purposes:
Definition
Html.php:56
MediaWiki\Widget\SpinnerWidget
PHP version of jquery.spinner.
Definition
SpinnerWidget.php:17
MediaWiki\Widget\SpinnerWidget\__construct
__construct(array $config=[])
Definition
SpinnerWidget.php:25
MediaWiki\Widget\SpinnerWidget\toString
toString()
Render element into HTML.
Definition
SpinnerWidget.php:52
MediaWiki\Widget\SpinnerWidget\__toString
__toString()
Magic method implementation.
Definition
SpinnerWidget.php:63
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
widget
SpinnerWidget.php
Generated on Fri Apr 26 2024 09:26:07 for MediaWiki by
1.10.0