20use Wikimedia\Minify\CSSMin;
30 private array $textModelsToParse;
42 $this->parserFactory = $parserFactory;
43 $this->userOptionsLookup = $userOptionsLookup;
50 return CssContent::class;
71 return new $class(
'/* #REDIRECT */@import ' . CSSMin::buildUrlValue(
$url ) .
';' );
78 '@phan-var CssContent $content';
81 if ( !$this->userOptionsLookup->getBoolOption( $pstParams->
getUser(),
'pst-cssjs' ) ) {
84 $popts->setPreSaveTransform(
false );
87 $text = $content->getText();
88 $pst = $this->parserFactory->getInstance()->preSaveTransform(
96 return new $class( $pst );
107 '@phan-var CssContent $content';
108 if ( in_array( $content->
getModel(), $this->textModelsToParse ) ) {
110 $output = $this->parserFactory->getInstance()
114 WikiPage::makeParserOptionsFromTitleAndModel(
129 [
'class' => [
'mw-code',
'mw-css' ],
'dir' =>
'ltr' ],
130 "\n" . $content->getText() .
"\n"
144class_alias( CssContentHandler::class,
'CssContentHandler' );
const CONTENT_FORMAT_CSS
For CSS pages.
Content handler for pages with source code as content (e.g.
Content handler for CSS pages.
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
supportsRedirects()
Returns true if this content model supports redirects.This default implementation returns false....
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.Unless $generateHtml...
__construct(string $modelId, Config $config, ParserFactory $parserFactory, UserOptionsLookup $userOptionsLookup)
makeRedirectContent(Title $destination, $text='')
Create a redirect that is also valid CSS.
A class containing constants representing the names of configuration variables.
const TextModelsToParse
Name constant for the TextModelsToParse setting, for use with Config::get()
Base representation for an editable wiki page.
Content objects represent page content, e.g.
getModel()
Get the content model ID.