namespace MediaWiki\EditPage;
-use MWNamespace;
+use MediaWiki\MediaWikiServices;
+use Sanitizer;
use Title;
use User;
* @return mixed[]
*/
public function mergeClassesIntoAttributes( array $classes, array $attribs ) {
- if ( !count( $classes ) ) {
+ if ( $classes === [] ) {
return $attribs;
}
- if ( isset( $attribs['class'] ) ) {
- $classes[] = $attribs['class'];
- }
- $attribs['class'] = implode( ' ', $classes );
-
- return $attribs;
+ return Sanitizer::mergeAttributes(
+ $attribs,
+ [ 'class' => implode( ' ', $classes ) ]
+ );
}
/**
public function getTextboxProtectionCSSClasses( Title $title ) {
$classes = []; // Textarea CSS
if ( $title->isProtected( 'edit' ) &&
- MWNamespace::getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
+ MediaWikiServices::getInstance()->getNamespaceInfo()->
+ getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
) {
# Is the title semi-protected?
if ( $title->isSemiProtected() ) {