mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateStyles
synced 2024-12-11 16:16:15 +00:00
b5ab3bac24
Bug: T338435 Change-Id: I7c2cb3ca5e38ce974187af316bf30e71b8e4ad49
36 lines
925 B
PHP
36 lines
925 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\TemplateStyles;
|
|
|
|
/**
|
|
* @file
|
|
* @license GPL-2.0-or-later
|
|
*/
|
|
|
|
use MediaWiki\Extension\CodeEditor\Hooks\CodeEditorGetPageLanguageHook;
|
|
use MediaWiki\Title\Title;
|
|
|
|
/**
|
|
* TemplateStyles extension hooks
|
|
* All hooks from the CodeEditor extension which is optional to use with this extension.
|
|
*/
|
|
class CodeEditorHooks implements
|
|
CodeEditorGetPageLanguageHook
|
|
{
|
|
/**
|
|
* Edit our CSS content model like core's CSS
|
|
* @param Title $title Title being edited
|
|
* @param string|null &$lang CodeEditor language to use
|
|
* @param string $model Content model
|
|
* @param string $format Content format
|
|
* @return bool
|
|
*/
|
|
public function onCodeEditorGetPageLanguage( Title $title, ?string &$lang, string $model, string $format ): bool {
|
|
if ( $model === 'sanitized-css' && Hooks::getConfig()->get( 'TemplateStylesUseCodeEditor' ) ) {
|
|
$lang = 'css';
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|