MediaWiki master
MediaWiki\Html Namespace Reference

Classes

class  FormOptions
 Helper class to keep track of options when mixing links and form elements. More...
 
class  Html
 This class is a collection of static functions that serve two purposes: More...
 
class  HtmlHelper
 Static utilities for manipulating HTML strings. More...
 
class  HtmlJsCode
 A wrapper class which causes Html::encodeJsVar() and Html::encodeJsCall() (as well as their Xml::* counterparts) to interpret a given string as being a JavaScript expression, instead of string data. More...
 
class  ListToggle
 Class for generating clickable toggle links for a list of checkboxes. More...
 
class  TemplateParser
 Handles compiling Mustache templates into PHP rendering functions. More...
 

Functions

 __construct (array $options, callable $shouldModifyCallback, callable $modifyCallback)
 
 addTocSection (string $id, string $msg,... $params)
 Add a section to the table of contents.
 
 addTocSubSection (string $id, string $msg,... $params)
 Add a sub-section to the table of contents.
 
 element (SerializerNode $parent, SerializerNode $node, $contents)
 
 getContext ()
 Returns the base IContextSource to use for this trait.
 
 getTocData ()
 
 startDocument ( $fragmentNamespace, $fragmentName)
 

Variables

trait HtmlHelperTrait
 Internal helper trait for HtmlHelper::modifyHtml.
 
trait TocGeneratorTrait
 Trait for special pages that generate a Table of Contents.
 

Detailed Description

Note
GPL-2.0-or-later

Function Documentation

◆ __construct()

MediaWiki\Html\__construct ( array $options,
callable $shouldModifyCallback,
callable $modifyCallback )

Definition at line 23 of file HtmlHelperTrait.php.

◆ addTocSection()

MediaWiki\Html\addTocSection ( string $id,
string $msg,
$params )
protected

Add a section to the table of contents.

This doesn't add the heading to the actual page.

Parameters
string$id"True" value of the ID attribute for the section, not HTML-entity escaped.
string$msgMessage key to use for the label
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float>...$params See Message::params()

Definition at line 46 of file TocGeneratorTrait.php.

◆ addTocSubSection()

MediaWiki\Html\addTocSubSection ( string $id,
string $msg,
$params )
protected

Add a sub-section to the table of contents.

This doesn't add the heading to the actual page.

Parameters
string$id"True" value of the ID attribute for the section, not HTML-entity escaped.
string$msgMessage key to use for the label
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float>...$params See Message::params()

Definition at line 73 of file TocGeneratorTrait.php.

◆ element()

MediaWiki\Html\element ( SerializerNode $parent,
SerializerNode $node,
$contents )
Parameters
SerializerNode$parent
SerializerNode$node
string | null$contents
Returns
string

Definition at line 38 of file HtmlHelperTrait.php.

Referenced by MediaWiki\Specials\SpecialUserLogout\alterForm(), MediaWiki\Content\JsonContent\arrayTable(), MediaWiki\Page\ImageHistoryList\beginImageHistoryList(), MediaWiki\HTMLForm\Field\HTMLTextField\buildCodexComponent(), MediaWiki\Xml\Xml\buildForm(), MediaWiki\ChangeTags\ChangeTags\buildTagFilterSelector(), MediaWiki\EditPage\Constraint\RedirectConstraint\checkConstraint(), MediaWiki\Api\ApiFormatBase\closePrinter(), MediaWiki\SpecialPage\ContributionsSpecialPage\contributionsSub(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Page\ImagePage\doRenderLangOpt(), MediaWiki\SpecialPage\ContributionsSpecialPage\execute(), MediaWiki\Specials\SpecialListGrants\execute(), MediaWiki\Specials\SpecialListGroupRights\execute(), MediaWiki\Specials\SpecialNamespaceInfo\execute(), MediaWiki\Specials\SpecialPasswordPolicies\execute(), MediaWiki\Specials\SpecialPreferences\execute(), MediaWiki\Specials\SpecialTrackingCategories\execute(), MediaWiki\Specials\SpecialVersion\execute(), MediaWiki\Installer\WebInstallerDBConnect\execute(), MediaWiki\Content\CssContentHandler\fillParserOutput(), MediaWiki\Content\JavaScriptContentHandler\fillParserOutput(), MediaWiki\Content\VueContentHandler\fillParserOutput(), MediaWiki\RecentChanges\ChangesList\flag(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), MediaWiki\Feed\FeedUtils\formatDiffRow2(), MediaWiki\Specials\SpecialFewestRevisions\formatResult(), MediaWiki\Specials\SpecialMostCategories\formatResult(), MediaWiki\Specials\SpecialMostInterwikis\formatResult(), MediaWiki\Specials\SpecialMostLinked\formatResult(), MediaWiki\Specials\SpecialMostLinkedCategories\formatResult(), MediaWiki\Specials\SpecialMostLinkedTemplates\formatResult(), MediaWiki\Specials\SpecialPagesWithProp\formatResult(), MediaWiki\Specials\SpecialShortPages\formatResult(), MediaWiki\Specials\SpecialUnwatchedPages\formatResult(), MediaWiki\SpecialPage\PageQueryPage\formatResult(), MediaWiki\Specials\Pager\NewPagesPager\formatRow(), MediaWiki\Specials\Pager\ProtectedTitlesPager\formatRow(), MediaWiki\Specials\Pager\ProtectedPagesPager\formatValue(), MediaWiki\Specials\Pager\UploadStashPager\formatValue(), MediaWiki\Search\SearchWidgets\FullSearchResultWidget\generateFileHtml(), MediaWiki\Specials\SpecialChangeCredentials\getAuthForm(), MediaWiki\SpecialPage\LoginSignupSpecialPage\getBenefitsContainerHtml(), MediaWiki\Page\ImageHistoryPseudoPager\getBody(), MediaWiki\HTMLForm\CodexHTMLForm\getButtons(), MediaWiki\Skin\BaseTemplate\getClear(), MediaWiki\Feed\FeedUtils\getDiffLink(), MediaWiki\Pager\TablePager\getEmptyBody(), MediaWiki\Installer\MysqlConnectForm\getHtml(), MediaWiki\Installer\PostgresConnectForm\getHtml(), MediaWiki\HTMLForm\Field\HTMLCheckField\getInputCodex(), MediaWiki\HTMLForm\Field\HTMLRadioField\getInputCodex(), MediaWiki\HTMLForm\Field\HTMLCheckField\getInputHTML(), MediaWiki\HTMLForm\Field\HTMLCheckMatrix\getInputHTML(), MediaWiki\HTMLForm\Field\HTMLFormFieldCloner\getInputHTMLForKey(), MediaWiki\Installer\DatabaseConnectForm\getInstallUserBox(), MediaWiki\Specials\FormFields\UploadSourceField\getLabelHtml(), MediaWiki\HTMLForm\CodexHTMLForm\getLegend(), MediaWiki\RecentChanges\EnhancedChangesList\getLineData(), MediaWiki\RevisionDelete\RevDelFileItem\getLink(), MediaWiki\Pager\TablePager\getStartBody(), MediaWiki\RecentChanges\ChangesList\getTimestamp(), MediaWiki\Installer\DatabaseSettingsForm\getWebUserBox(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\headerHtml(), MediaWiki\Page\ImageHistoryList\imageHistoryLine(), MediaWiki\RecentChanges\ChangesList\insertDateHeader(), MediaWiki\Html\Html\linkButton(), MediaWiki\SpecialPage\LoginSignupSpecialPage\mainLoginForm(), MediaWiki\Linker\Linker\makeBrokenImageLinkObj(), MediaWiki\Linker\Linker\makeExternalImage(), MediaWiki\Installer\WebInstaller\makeLinkItem(), MediaWiki\Search\SearchWidgets\SearchFormWidget\makeSearchLink(), MediaWiki\Specials\SpecialInterwiki\makeTable(), MediaWiki\Api\ApiMain\modifyHelp(), MediaWiki\Content\JsonContent\objectRow(), MediaWiki\Content\JsonContent\objectTable(), MediaWiki\Page\ImagePage\openShowImage(), MediaWiki\Xml\Xml\option(), MediaWiki\Specials\SpecialMediaStatistics\outputMediaType(), MediaWiki\Specials\FormFields\Licenses\outputOption(), MediaWiki\Specials\SpecialChangeContentModel\postHtml(), MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences(), MediaWiki\RecentChanges\EnhancedChangesList\recentChangesBlock(), MediaWiki\Specials\Helpers\ImportReporter\reportNotice(), MediaWiki\RecentChanges\ChangesList\revDateLink(), MediaWiki\Content\JsonContent\rootValueTable(), MediaWiki\Specials\SpecialSearch\setupPage(), MediaWiki\RecentChanges\ChangesList\showCharacterDifference(), MediaWiki\Specials\SpecialBlockList\showList(), MediaWiki\Specials\SpecialPrefixIndex\showPrefixChunk(), MediaWiki\Specials\SpecialChangeCredentials\showSubpageList(), MediaWiki\Page\ImagePage\showTOC(), MediaWiki\Html\Html\submitButton(), MediaWiki\Media\ThumbnailImage\toHtml(), MediaWiki\Page\ImagePage\uploadLinksBox(), MediaWiki\Content\JsonContent\valueCell(), and MediaWiki\Page\ImagePage\view().

◆ getContext()

MediaWiki\Html\getContext ( )
abstract

Returns the base IContextSource to use for this trait.

Note
If the using class inherits from ContextSource this method will be provided by ContextSource::getContext().
Returns
IContextSource

◆ getTocData()

MediaWiki\Html\getTocData ( )
protected

Definition at line 28 of file TocGeneratorTrait.php.

◆ startDocument()

MediaWiki\Html\startDocument ( $fragmentNamespace,
$fragmentName )
Parameters
string | null$fragmentNamespace
string | null$fragmentName
Returns
string

Definition at line 59 of file HtmlHelperTrait.php.

Variable Documentation

◆ HtmlHelperTrait

trait MediaWiki::Html\HtmlHelperTrait
Initial value:
{
private callable $shouldModifyCallback

Internal helper trait for HtmlHelper::modifyHtml.

This is designed to extend a HtmlFormatter.

Definition at line 16 of file HtmlHelperTrait.php.

Referenced by MediaWiki\Html\HtmlHelper\modifyElements().

◆ TocGeneratorTrait

trait MediaWiki::Html\TocGeneratorTrait
Initial value:
{
private ?TOCData $tocData = null

Trait for special pages that generate a Table of Contents.

It is expected that the class using this trait inherits from ContextSource, which will provide the abstract ::getContext() method. Another source of context can be provided by re-implementing ::getContext().

Since
1.45

Definition at line 22 of file TocGeneratorTrait.php.