GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Manual:Hooks/ContentHandlerDefaultModelFor - MediaWiki

< Manual:Hooks
ContentHandlerDefaultModelFor
Available from version 1.21.0
Allows control over which content model a given title will default to.
Define function:
public static function onContentHandlerDefaultModelFor( MediaWiki\Title\Title $title, ?string &$model ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ContentHandlerDefaultModelFor": "MediaWiki\\Extension\\MyExtension\\Hooks::onContentHandlerDefaultModelFor"
	}
}
Called from: File(s): Revision/MainSlotRoleHandler.php
Interface: ContentHandlerDefaultModelForHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ContentHandlerDefaultModelFor extensions.

Details

  • \Title $title: Title for which the default content model is to be determined.
  • ?string &$model: The desired model. A handler function can change this to control the model that will be used for the given title. Usually uses one of the CONTENT_MODEL_xxx constants.

Return false to bypass any built-in rules for determining the model, such as the file extensions ".js" and ".css" on user subpages. Return true to keep applying these rules.

For more information on content models, see ContentHandler, and for a tutorial about creating content models in extensions, see Manual:Page content models.

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Hooks/ContentHandlerDefaultModelFor&oldid=8172494"
Categories:
  • MediaWiki hooks
  • Hooks added in MediaWiki 1.21.0
  • MediaWiki hooks included in MainSlotRoleHandler.php
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.