Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7395965
JsonSchemaCodeEditorHooks.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
JsonSchemaCodeEditorHooks.php
View Options
<?php
namespace
MediaWiki\Extension\EventLogging
;
use
MediaWiki\Extension\CodeEditor\Hooks\CodeEditorGetPageLanguageHook
;
use
MediaWiki\Title\Title
;
/**
* EventLogging has a soft dependency on CodeEditor. Specifically, if CodeEditor is loaded, then EventLogging sets the
* code language for pages in the Schema namespace to JSON by responding to the CodeEditorGetPageLanguage hook. We
* maintain that soft dependency on CodeEditor by isolating CodeEditor-specific hook handlers to a class that will
* only be autoloaded only when the hook fires.
*/
class
JsonSchemaCodeEditorHooks
implements
CodeEditorGetPageLanguageHook
{
private
JsonSchemaHooksHelper
$jsonSchemaHooksHelper
;
public
function
__construct
(
JsonSchemaHooksHelper
$jsonSchemaHooksHelper
)
{
$this
->
jsonSchemaHooksHelper
=
$jsonSchemaHooksHelper
;
}
public
function
onCodeEditorGetPageLanguage
(
Title
$title
,
?
string
&
$lang
,
string
$model
,
string
$format
):
void
{
if
(
$this
->
jsonSchemaHooksHelper
->
isSchemaNamespaceEnabled
()
&&
$title
->
inNamespace
(
NS_SCHEMA
)
)
{
$lang
=
'json'
;
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 13:58 (2 d, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bf/e6/8d710e1c268a43652847e6b5bd99
Default Alt Text
JsonSchemaCodeEditorHooks.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment