MediaWiki REL1_33
GadgetDefinitionContentHandler.php
Go to the documentation of this file.
1<?php
24 public function __construct() {
25 parent::__construct( 'GadgetDefinition' );
26 }
27
32 public function canBeUsedOn( Title $title ) {
33 return $title->inNamespace( NS_GADGET_DEFINITION );
34 }
35
36 protected function getContentClass() {
37 return 'GadgetDefinitionContent';
38 }
39
40 public function makeEmptyContent() {
41 $class = $this->getContentClass();
42 return new $class( FormatJson::encode( $this->getDefaultMetadata(), "\t" ) );
43 }
44
45 public function getDefaultMetadata() {
46 return [
47 'settings' => [
48 'rights' => [],
49 'default' => false,
50 'hidden' => false,
51 'skins' => [],
52 'category' => ''
53 ],
54 'module' => [
55 'scripts' => [],
56 'styles' => [],
57 'peers' => [],
58 'dependencies' => [],
59 'messages' => [],
60 'type' => '',
61 ],
62 ];
63 }
64}
makeEmptyContent()
Creates an empty TextContent object.
Content handler for JSON.
Represents a title within MediaWiki.
Definition Title.php:40