class Frontend implements ExtenderInterface

Methods

__construct(string $frontend)

No description

css(string $path)

<p>Add a CSS file to load in the frontend.</p>

js(string $path)

<p>Add a JavaScript file to load in the frontend.</p>

route(string $path, string $name, callable|string|null $content = null)

<p>Add a route to the frontend.</p>

removeRoute(string $name)

<p>Remove a route from the frontend.</p>

content($callback)

<p>Modify the content of the frontend.</p>

extend(Container $container, Extension $extension = null)

No description

Details

__construct(string $frontend)

Parameters

string $frontend

Frontend css(string $path)

<p>Add a CSS file to load in the frontend.</p>

Parameters

string $path

Return Value

Frontend

Frontend js(string $path)

<p>Add a JavaScript file to load in the frontend.</p>

Parameters

string $path

Return Value

Frontend

Frontend route(string $path, string $name, callable|string|null $content = null)

<p>Add a route to the frontend.</p>

Parameters

string $path
string $name
callable|string|null $content <p>The content can be a closure or an invokable class, and should accept:</p> <ul> <li>\Flarum\Frontend\Document $document</li> <li>\Psr\Http\Message\ServerRequestInterface $request</li> </ul> <p>The callable should return void.</p>

Return Value

Frontend

Frontend removeRoute(string $name)

<p>Remove a route from the frontend.</p>

<p>This is necessary before overriding a route.</p>

Parameters

string $name

Return Value

Frontend

Frontend content($callback)

<p>Modify the content of the frontend.</p>

Parameters

$callback

Return Value

Frontend

extend(Container $container, Extension $extension = null)

Parameters

Container $container
Extension $extension