mediawiki-skins-MinervaNeue/includes/MinervaUI.php
thiemowmde cea344c168 MinervaUI: Remove unused code
Same as Ie1c2e93 in MobileFrontend.

Change-Id: I6508f5882609a0f528bcfa0eb66a5ddcb5e1b8b7
2023-06-30 09:05:45 +02:00

58 lines
1.8 KiB
PHP

<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace MediaWiki\Minerva;
use RuntimeException;
/**
* FIXME: Use OOUI when available
*
* Helper methods for generating parts of the UI.
*/
class MinervaUI {
/**
* Get CSS classes for icons
* @param string|null $iconName
* @param string $iconType element or before
* @param string $additionalClassNames additional class names you want to associate
* with the iconed element
* @param string $iconPrefix optional prefix for icons. Defaults to minerva.
* @return string class name for use with HTML element
*/
public static function iconClass( $iconName, $iconType = 'element', $additionalClassNames = '',
$iconPrefix = 'minerva'
) {
$base = 'mw-ui-icon';
$modifiers = 'mw-ui-icon-' . $iconType;
if ( $iconName ) {
$modifiers .= ' mw-ui-icon-' . $iconPrefix . '-' . $iconName;
}
if ( $iconType === 'element' ) {
$additionalClassNames .= ' mw-ui-button mw-ui-quiet';
} elseif ( $iconType === 'before' ) {
throw new RuntimeException( 'iconClass before type is no longer supported.' );
}
return $base . ' ' . $modifiers . ' ' . $additionalClassNames;
}
}