Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1430777
WikimediaUITheme.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
WikimediaUITheme.php
View Options
<?php
namespace
OOUI
;
class
WikimediaUITheme
extends
Theme
{
/* Methods */
/** @inheritDoc */
public
function
getElementClasses
(
Element
$element
)
{
$variants
=
[
'invert'
=>
false
,
'progressive'
=>
false
,
'destructive'
=>
false
,
'error'
=>
false
,
'warning'
=>
false
,
'success'
=>
false
];
// Parent method
$classes
=
parent
::
getElementClasses
(
$element
);
if
(
$element
instanceof
IconWidget
&&
$element
->
hasClass
(
'oo-ui-checkboxInputWidget-checkIcon'
)
)
{
// Icon on CheckboxInputWidget
$variants
[
'invert'
]
=
true
;
}
elseif
(
$element
->
supports
(
[
'hasFlag'
]
)
)
{
// @phan-suppress-next-line PhanUndeclaredMethod
$isFramed
=
$element
->
supports
(
[
'isFramed'
]
)
&&
$element
->
isFramed
();
// @phan-suppress-next-line PhanUndeclaredMethod
$isActive
=
$element
->
supports
(
[
'isActive'
]
)
&&
$element
->
isActive
();
if
(
$isFramed
&&
(
$isActive
||
$element
->
isDisabled
()
||
$element
->
hasFlag
(
'primary'
)
)
)
{
// Button with a dark background, use white icon
$variants
[
'invert'
]
=
true
;
}
elseif
(
!
$isFramed
&&
$element
->
isDisabled
()
&&
!
$element
->
hasFlag
(
'invert'
)
)
{
// Frameless disabled button, always use black icon regardless of flags
$variants
[
'invert'
]
=
false
;
}
elseif
(
!
$element
->
isDisabled
()
)
{
// Any other kind of button, use the right colored icon if available
$variants
[
'progressive'
]
=
$element
->
hasFlag
(
'progressive'
);
$variants
[
'destructive'
]
=
$element
->
hasFlag
(
'destructive'
);
$variants
[
'invert'
]
=
$element
->
hasFlag
(
'invert'
);
$variants
[
'error'
]
=
$element
->
hasFlag
(
'error'
);
$variants
[
'warning'
]
=
$element
->
hasFlag
(
'warning'
);
$variants
[
'success'
]
=
$element
->
hasFlag
(
'success'
);
}
}
foreach
(
$variants
as
$variant
=>
$toggle
)
{
$classes
[
$toggle
?
'on'
:
'off'
][]
=
'oo-ui-image-'
.
$variant
;
}
return
$classes
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 16, 19:33 (4 h, 14 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
15/b1/9c019ba93a2b0069a4211d5eb159
Default Alt Text
WikimediaUITheme.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment