namespace MediaWiki\EditPage;
+use MWNamespace;
use Title;
use User;
return $wikitext;
}
+ /**
+ * @param string[] $classes
+ * @param mixed[] $attribs
+ * @return mixed[]
+ */
+ public function mergeClassesIntoAttributes( array $classes, array $attribs ) {
+ if ( !count( $classes ) ) {
+ return $attribs;
+ }
+
+ if ( isset( $attribs['class'] ) ) {
+ $classes[] = $attribs['class'];
+ }
+ $attribs['class'] = implode( ' ', $classes );
+
+ return $attribs;
+ }
+
+ /**
+ * @param Title $title
+ * @return string[]
+ */
+ public function getTextboxProtectionCSSClasses( Title $title ) {
+ $classes = []; // Textarea CSS
+ if ( $title->isProtected( 'edit' ) &&
+ MWNamespace::getRestrictionLevels( $title->getNamespace() ) !== [ '' ]
+ ) {
+ # Is the title semi-protected?
+ if ( $title->isSemiProtected() ) {
+ $classes[] = 'mw-textarea-sprotected';
+ } else {
+ # Then it must be protected based on static groups (regular)
+ $classes[] = 'mw-textarea-protected';
+ }
+ # Is the title cascade-protected?
+ if ( $title->isCascadeProtected() ) {
+ $classes[] = 'mw-textarea-cprotected';
+ }
+ }
+
+ return $classes;
+ }
+
/**
* @param string $name
* @param mixed[] $customAttribs