Jump to content

Manuel:ContentHandler.php

From mediawiki.org
This page is a translated version of the page Manual:ContentHandler.php and the translation is 100% complete.
Version de MediaWiki :
1.21

ContentHandler.php contient la classe ContentHandler qui est l'interface de base pour la gestion de contenu.

Generally, for every type of content model, there is one subclass of Content and one subclass of ContentHandler. Where subclasses of Content deal with page content regardless how it relates to the wiki page, subclasses of ContentHandler are designed to deal with a specific type of content on a wiki page.

  • Content is stored in the database in a serialized form (using a serialization format a.k.a. MIME type) and is unserialized into its native PHP representation (the content model), which is wrapped in an instance of the appropriate subclass of Content.
  • ContentHandler instances are stateless singletons that serve, among other things, as a factory for Content objects.

Some content types have a flat model, that is, their native representation is the same as their serialized form. Examples would be JavaScript and CSS code. As of now, this also applies to wikitext (MediaWiki's default content type), but wikitext content may be represented by a DOM or AST structure in the future.

Public methods

  • makeContent() - create a Content object from given textual representation. Text will be deserialized according to given content model.
  • getLocalizedName()
  • serializeContent()
  • exportTransform()
  • unserializeContent()
  • importTransform()
  • makeEmptyContent()
  • makeRedirectContent()
  • getModelID()
  • getSupportedFormats()
  • getDefaultFormat()
  • isSupportedFormat()
  • getActionOverrides()
  • createDifferenceEngine()
  • getSlotDiffRenderer()
  • getPageLanguage()
  • getPageViewLanguage()
  • canBeUsedOn()
  • merge3()
  • getLanguageConverter()
  • getAutosummary()
  • getChangeTag()
  • getAutoDeleteReason()
  • isParserCacheSupported()
  • supportsSections()
  • supportsCategories()
  • supportsRedirects()
  • supportsDirectEditing()
  • supportsPreloadContent()
  • generateHTMLOnEdit()
  • supportsDirectApiEditing()
  • getFieldsForSearchIndex()
  • getDataForSearchIndex()
  • getParserOutputForIndexing()
  • getSecondaryDataUpdates()
  • getDeletionUpdates()
  • preSaveTransform()
  • preloadTransform()
  • validateSave()
  • getParserOutput() - produce a page output suitable for indexing, typically used with getDataForSearchIndex(). Since 1.38
  • fillParserOutputInternal - since 1.38

Deprecated

  • getContentText() - get flat text from a Content object. Deprecated since 1.37 in favour of Content::getText() for TextContent instances.
  • getDefaultModelFor() - deprecated in favour of SlotRoleHandler::getDefaultModel().
  • getForTitle()
  • getForContent()
  • getForModelID()
  • getContentModels() - deprecated since 1.35 in favour of ContentHandlerFactory::getContentModels()
  • getAllContentFormats() - deprecated since 1.35

Extended by

Voir aussi