abstract class Formatter (View source)

An extender to register formatting callbacks.

Waterhole uses the TextFormatter library to safely format markup in posts and comments. You can hook in to add or remove formatting syntax and change rendered HTML.

Methods

static void
configure(callable $callback)

Add a configuration callback to the formatter.

static void
parsing(callable $callback)

Add a parsing callback to the formatter.

static void
rendering(callable $callback)

Add a rendering callback to the formatter.

Details

static void configure(callable $callback)

Add a configuration callback to the formatter.

Parameters

callable $callback

Return Value

void

static void parsing(callable $callback)

Add a parsing callback to the formatter.

In the parsing phase, user-submitted text is parsed into an XML document for storage in the database. Here you can perform runtime configuration on the parser, or make manual alterations to the $text before it is parsed.

Parameters

callable $callback

Return Value

void

static void rendering(callable $callback)

Add a rendering callback to the formatter.

The rendering phase is when the XML document stored in the database is transformed into HTML. Here you can perform runtime configuration on the renderer, or make manual alterations to the $xml document before it is rendered.

Parameters

callable $callback

Return Value

void