Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | List of all members
SMW\MediaWiki\Content\SchemaContent Class Reference
Inheritance diagram for SMW\MediaWiki\Content\SchemaContent:
Inheritance graph
[legend]
Collaboration diagram for SMW\MediaWiki\Content\SchemaContent:
Collaboration graph
[legend]

Public Member Functions

 __construct ( $text)
 
 __sleep ()
 
 toJson ()
 
 isYaml ()
 
 isValid ()
 
 fillParserOutput (Title $title, $revId, ParserOptions $options, $generateHtml, ParserOutput &$output)
 
 prepareSave (WikiPage $page, $flags, $parentRevId, User $user)
 
 preSaveTransform (Title $title, User $user, ParserOptions $popts)
 
 setServices (SchemaFactory $schemaFactory, SchemaContentFormatter $contentFormatter=null)
 

Static Public Member Functions

static normalizeLineEndings ( $text)
 

Detailed Description

The content model supports both JSON and YAML (as a superset of JSON), allowing for its content to be represented in JSON when required while a user may choose YAML to edit/store the native content (due to improve readability or aid others with additional inline comments).

Comments (among other elements) will not be represented in JSON output when requested by the Content::toJson method.

See also
https://en.wikipedia.org/wiki/YAML#Comparison_with_JSON

GNU GPL v2+

Since
3.0
Author
mwjames

Constructor & Destructor Documentation

◆ __construct()

SMW\MediaWiki\Content\SchemaContent::__construct (   $text)
Since
3.0

Member Function Documentation

◆ __sleep()

SMW\MediaWiki\Content\SchemaContent::__sleep ( )

This class doesn't own the properties but needs to guard against a possible serialization attempt. (

See also
#4210)
Since
3.1
Returns
array

◆ fillParserOutput()

SMW\MediaWiki\Content\SchemaContent::fillParserOutput ( Title  $title,
  $revId,
ParserOptions  $options,
  $generateHtml,
ParserOutput &  $output 
)
Since
3.0

◆ isValid()

SMW\MediaWiki\Content\SchemaContent::isValid ( )
See also
Content::isValid
Since
3.0

◆ isYaml()

SMW\MediaWiki\Content\SchemaContent::isYaml ( )
Since
3.0
Parameters
boolean

◆ normalizeLineEndings()

static SMW\MediaWiki\Content\SchemaContent::normalizeLineEndings (   $text)
static
See also
TextContent::normalizeLineEndings (MW 1.28+)
Parameters
$text
Returns
string

◆ prepareSave()

SMW\MediaWiki\Content\SchemaContent::prepareSave ( WikiPage  $page,
  $flags,
  $parentRevId,
User  $user 
)
See also
Content::prepareSave
Since
3.1

◆ preSaveTransform()

SMW\MediaWiki\Content\SchemaContent::preSaveTransform ( Title  $title,
User  $user,
ParserOptions  $popts 
)
Since
3.0

◆ setServices()

SMW\MediaWiki\Content\SchemaContent::setServices ( SchemaFactory  $schemaFactory,
SchemaContentFormatter  $contentFormatter = null 
)
Since
3.0
Parameters
SchemaFactory$schemaFactory
SchemaContentFormatter | null$contentFormatter

◆ toJson()

SMW\MediaWiki\Content\SchemaContent::toJson ( )

Content::getNativeData will return the "native" text representation which in case of YAML is just the text and not a JSON string. Therefore getNativeData preserves the original user input.

Instead, use this method to retrieve a JSON compatible string for both JSON and YAML for when the data is valid.

Since
3.0
Returns
null|string

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

About | General disclaimer | Privacy policy