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
use Stringable;
8
18
class
SpinnerWidget
implements
Stringable {
19
21
private
$attributes;
23
private
$content;
24
28
public
function
__construct
( array $config = [] ) {
29
$size = $config[
'size'
] ??
'small'
;
30
$type = $config[
'type'
] ??
'inline'
;
31
32
$this->attributes = [];
33
34
if
( isset( $config[
'id'
] ) ) {
35
$this->attributes[
'id'
] = $config[
'id'
];
36
}
37
38
// Initialization
39
$this->attributes[
'class'
] = [
40
'mw-spinner'
,
41
$size ===
'small'
?
'mw-spinner-small'
:
'mw-spinner-large'
,
42
$type ===
'inline'
?
'mw-spinner-inline'
:
'mw-spinner-block'
,
43
];
44
45
$this->content =
46
'<div class="mw-spinner-container">'
.
47
str_repeat(
'<div></div>'
, 12 ) .
48
'</div>'
;
49
}
50
55
public
function
toString
() {
56
return
Html::rawElement(
'div'
, $this->attributes, $this->content );
57
}
58
66
public
function
__toString
() {
67
try
{
68
return
$this->
toString
();
69
}
catch
( Exception $ex ) {
70
trigger_error( (
string
)$ex, E_USER_ERROR );
71
}
72
}
73
}
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:18
MediaWiki\Widget\SpinnerWidget\__construct
__construct(array $config=[])
Definition
SpinnerWidget.php:28
MediaWiki\Widget\SpinnerWidget\toString
toString()
Render element into HTML.
Definition
SpinnerWidget.php:55
MediaWiki\Widget\SpinnerWidget\__toString
__toString()
Magic method implementation.
Definition
SpinnerWidget.php:66
MediaWiki\Widget
Definition
CheckMatrixWidget.php:3
includes
widget
SpinnerWidget.php
Generated on Sat Oct 5 2024 11:26:06 for MediaWiki by
1.10.0