MediaWiki REL1_39
MediaWiki\HtmlHelper Class Reference

Static utilities for manipulating HTML strings. More...

Static Public Member Functions

static modifyElements (string $htmlFragment, callable $shouldModifyCallback, callable $modifyCallback)
 Modify elements of an HTML fragment via a user-provided callback.
 

Detailed Description

Static utilities for manipulating HTML strings.

Definition at line 17 of file HtmlHelper.php.

Member Function Documentation

◆ modifyElements()

static MediaWiki\HtmlHelper::modifyElements ( string $htmlFragment,
callable $shouldModifyCallback,
callable $modifyCallback )
static

Modify elements of an HTML fragment via a user-provided callback.

Parameters
string$htmlFragmentHTML fragment. Must be valid (ie. coming from the parser, not the user).
callable$shouldModifyCallbackA callback which takes a single RemexHtml\Serializer\SerializerNode argument, and returns true if it should be modified.
callable$modifyCallbackA callback which takes a single RemexHtml\Serializer\SerializerNode argument and actually performs the modification on it. It must return the new node (which can be the original node object).
Returns
string

Definition at line 30 of file HtmlHelper.php.


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