MediaWiki  1.30.0
GadgetDefinitionContent Class Reference
Inheritance diagram for GadgetDefinitionContent:
Collaboration diagram for GadgetDefinitionContent:

Public Member Functions

 __construct ( $text)
 
 beautifyJSON ()
 Pretty-print JSON. More...
 
 getAssocArray ()
 Get the JSON content as an associative array with all fields filled out, populating defaults as necessary. More...
 
 getDeletionUpdates (WikiPage $page, ParserOutput $parserOutput=null)
 
 getSecondaryDataUpdates (Title $title, Content $old=null, $recursive=true, ParserOutput $parserOutput=null)
 
 isValid ()
 
 validate ()
 
- Public Member Functions inherited from JsonContent
 __construct ( $text, $modelId=CONTENT_MODEL_JSON)
 
 getData ()
 Decodes the JSON string. More...
 
 getJsonData ()
 Decodes the JSON into a PHP associative array. More...
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 Beautifies JSON prior to save. More...
 
- Public Member Functions inherited from TextContent
 convert ( $toModel, $lossy='')
 This implementation provides lossless conversion between content models based on TextContent. More...
 
 copy ()
 
 diff (Content $that, Language $lang=null)
 Diff this content object with another content object. More...
 
 getNativeData ()
 Returns the text represented by this Content object, as a string. More...
 
 getSize ()
 Returns the text's size in bytes. More...
 
 getTextForSearchIndex ()
 Returns the text represented by this Content object, as a string. More...
 
 getTextForSummary ( $maxlength=250)
 Returns a textual representation of the content suitable for use in edit summaries and log messages. More...
 
 getWikitextForTransclusion ()
 Returns attempts to convert this content object to wikitext, and then returns the text string. More...
 
 isCountable ( $hasLinks=null)
 Returns true if this content is not a redirect, and $wgArticleCountMethod is "any". More...
 
- Public Member Functions inherited from AbstractContent
 addSectionHeader ( $header)
 
 equals (Content $that=null)
 
 getContentHandler ()
 
 getDefaultFormat ()
 
 getModel ()
 
 getParserOutput (Title $title, $revId=null, ParserOptions $options=null, $generateHtml=true)
 Returns a ParserOutput object containing information derived from this content. More...
 
 getRedirectChain ()
 
 getRedirectTarget ()
 Subclasses that implement redirects should override this. More...
 
 getSection ( $sectionId)
 
 getSupportedFormats ()
 
 getUltimateRedirectTarget ()
 
 isEmpty ()
 
 isRedirect ()
 
 isSupportedFormat ( $format)
 
 matchMagicWord (MagicWord $word)
 This default implementation always returns false. More...
 
 preloadTransform (Title $title, ParserOptions $popts, $params=[])
 
 prepareSave (WikiPage $page, $flags, $parentRevId, User $user)
 
 replaceSection ( $sectionId, Content $with, $sectionTitle='')
 
 serialize ( $format=null)
 
 updateRedirect (Title $target)
 This default implementation always returns $this. More...
 

Protected Member Functions

 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 Register some links. More...
 
- Protected Member Functions inherited from JsonContent
 arrayRow ( $val)
 Create HTML table row representing the value in an array. More...
 
 arrayTable ( $mapping)
 Create HTML table representing a JSON array. More...
 
 objectRow ( $key, $val)
 Create HTML table row representing one object property. More...
 
 objectTable ( $mapping)
 Create HTML table representing a JSON object. More...
 
 primitiveValue ( $val)
 Construct text representing a JSON primitive value. More...
 
 rootValueTable ( $val)
 Construct HTML table representation of any JSON value. More...
 
 valueCell ( $val)
 Construct HTML table cell representing any JSON value. More...
 
- Protected Member Functions inherited from TextContent
 getHighlightHtml ()
 Generates an HTML version of the content, for display. More...
 
 getHtml ()
 Generates an HTML version of the content, for display. More...
 
- Protected Member Functions inherited from AbstractContent
 checkFormat ( $format)
 
 checkModelID ( $modelId)
 

Additional Inherited Members

- Static Public Member Functions inherited from TextContent
static normalizeLineEndings ( $text)
 Do a "\\r\\n" -> "\\n" and "\\r" -> "\\n" transformation as well as trim trailing whitespace. More...
 
- Protected Attributes inherited from JsonContent
Status $jsonParse
 
- Protected Attributes inherited from AbstractContent
 $model_id
 Name of the content model this Content object represents. More...
 

Detailed Description

Definition at line 23 of file GadgetDefinitionContent.php.

Constructor & Destructor Documentation

◆ __construct()

GadgetDefinitionContent::__construct (   $modelId)
Parameters
string$modelId
Since
1.21

Reimplemented from AbstractContent.

Definition at line 25 of file GadgetDefinitionContent.php.

Member Function Documentation

◆ beautifyJSON()

GadgetDefinitionContent::beautifyJSON ( )

Pretty-print JSON.

If called before validation, it may return JSON "null".

Returns
string

Reimplemented from JsonContent.

Definition at line 41 of file GadgetDefinitionContent.php.

References FormatJson\encode(), getAssocArray(), and FormatJson\UTF8_OK.

◆ fillParserOutput()

GadgetDefinitionContent::fillParserOutput ( Title  $title,
  $revId,
ParserOptions  $options,
  $generateHtml,
ParserOutput $output 
)
protected

Register some links.

Parameters
Title$title
int$revId
ParserOptions$options
bool$generateHtml
ParserOutput&$output

Reimplemented from JsonContent.

Definition at line 55 of file GadgetDefinitionContent.php.

References $options, $output, $title, $type, as, getAssocArray(), and Title\makeTitleSafe().

◆ getAssocArray()

GadgetDefinitionContent::getAssocArray ( )

Get the JSON content as an associative array with all fields filled out, populating defaults as necessary.

Returns
array

Definition at line 88 of file GadgetDefinitionContent.php.

References $handler, AbstractContent\getContentHandler(), JsonContent\getData(), wfArrayPlus2d(), and wfObjectToArray().

Referenced by beautifyJSON(), fillParserOutput(), Gadget\newFromDefinitionContent(), and validate().

◆ getDeletionUpdates()

GadgetDefinitionContent::getDeletionUpdates ( WikiPage  $page,
ParserOutput  $parserOutput = null 
)
Parameters
WikiPage$page
ParserOutput$parserOutput
Returns
DataUpdate[]

Reimplemented from AbstractContent.

Definition at line 102 of file GadgetDefinitionContent.php.

References WikiPage\getTitle().

◆ getSecondaryDataUpdates()

GadgetDefinitionContent::getSecondaryDataUpdates ( Title  $title,
Content  $old = null,
  $recursive = true,
ParserOutput  $parserOutput = null 
)
Parameters
Title$title
Content$old
bool$recursive
ParserOutput$parserOutput
Returns
DataUpdate[]

Reimplemented from AbstractContent.

Definition at line 116 of file GadgetDefinitionContent.php.

References $title.

◆ isValid()

GadgetDefinitionContent::isValid ( )
Returns
bool Whether content is valid.

Reimplemented from JsonContent.

Definition at line 29 of file GadgetDefinitionContent.php.

References validate().

◆ validate()

GadgetDefinitionContent::validate ( )
Returns
Status

Definition at line 73 of file GadgetDefinitionContent.php.

References getAssocArray(), and JsonContent\getData().

Referenced by isValid().


The documentation for this class was generated from the following file: