MediaWiki  1.23.2
TitleFormatter Interface Reference

A title formatter service for MediaWiki. More...

Inheritance diagram for TitleFormatter:

Public Member Functions

 formatTitle ( $namespace, $text, $fragment='')
 Returns the title formatted for display. More...
 
 getFullText (TitleValue $title)
 Returns the title formatted for display, with namespace and fragment. More...
 
 getNamespaceName ( $namespace, $text)
 Returns the name of the namespace for the given title. More...
 
 getPrefixedText (TitleValue $title)
 Returns the title formatted for display, including the namespace name. More...
 
 getText (TitleValue $title)
 Returns the title text formatted for display, without namespace of fragment. More...
 

Detailed Description

A title formatter service for MediaWiki.

This is designed to encapsulate knowledge about conventions for the title forms to be used in the database, in urls, in wikitext, etc.

See also
https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue

Definition at line 33 of file TitleFormatter.php.

Member Function Documentation

◆ formatTitle()

TitleFormatter::formatTitle (   $namespace,
  $text,
  $fragment = '' 
)

Returns the title formatted for display.

Per default, this includes the namespace but not the fragment.

Note
Normalization is applied if $title is not in TitleValue::TITLE_FORM.
Parameters
int | bool$namespaceThe namespace ID (or false, if the namespace should be ignored)
string$textThe page title
string$fragmentThe fragment name (may be empty).
Returns
string

Implemented in MediaWikiTitleCodec.

◆ getFullText()

TitleFormatter::getFullText ( TitleValue  $title)

Returns the title formatted for display, with namespace and fragment.

Parameters
TitleValue$titlethe title to format
Returns
string

Implemented in MediaWikiTitleCodec.

◆ getNamespaceName()

TitleFormatter::getNamespaceName (   $namespace,
  $text 
)

Returns the name of the namespace for the given title.

Note
This must take into account gender sensitive namespace names.
Todo:
Move this to a separate interface
Parameters
int$namespace
string$text
Exceptions
InvalidArgumentException
Returns
String

Implemented in MediaWikiTitleCodec.

◆ getPrefixedText()

TitleFormatter::getPrefixedText ( TitleValue  $title)

Returns the title formatted for display, including the namespace name.

Parameters
TitleValue$titlethe title to format
Returns
string

Implemented in MediaWikiTitleCodec.

◆ getText()

TitleFormatter::getText ( TitleValue  $title)

Returns the title text formatted for display, without namespace of fragment.

Note
: Only minimal normalization is applied. Consider using TitleValue::getText() directly.
Parameters
TitleValue$titlethe title to format
Returns
string

Implemented in MediaWikiTitleCodec.


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