MediaWiki  1.34.0
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 }
FormatJson\encode
static encode( $value, $pretty=false, $escaping=0)
Returns the JSON representation of a value.
Definition: FormatJson.php:115
GadgetDefinitionContentHandler\getContentClass
getContentClass()
Definition: GadgetDefinitionContentHandler.php:36
$title
$title
Definition: testCompression.php:34
GadgetDefinitionContentHandler\canBeUsedOn
canBeUsedOn(Title $title)
Definition: GadgetDefinitionContentHandler.php:32
GadgetDefinitionContentHandler
Definition: GadgetDefinitionContentHandler.php:23
GadgetDefinitionContentHandler\makeEmptyContent
makeEmptyContent()
Creates an empty TextContent object.
Definition: GadgetDefinitionContentHandler.php:40
Title
Represents a title within MediaWiki.
Definition: Title.php:42
GadgetDefinitionContentHandler\getDefaultMetadata
getDefaultMetadata()
Definition: GadgetDefinitionContentHandler.php:45
JsonContentHandler
Content handler for JSON.
Definition: JsonContentHandler.php:30
GadgetDefinitionContentHandler\__construct
__construct()
Definition: GadgetDefinitionContentHandler.php:24