class Theme implements ExtenderInterface

Methods

overrideLessImport(string $file, string $newFilePath, string $extensionId = null)

This can be used to override LESS files that are imported within the code.

overrideFileSource(string $file, string $newFilePath, string $extensionId = null)

This method allows overriding LESS file sources.

addCustomLessFunction(string $functionName, callable $callable)

This method allows you to add custom Less functions.

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

No description

Details

Theme overrideLessImport(string $file, string $newFilePath, string $extensionId = null)

This can be used to override LESS files that are imported within the code.

For example, core's `forum.less` file imports a `forum/DiscussionListItem.less` file. The contents of this file can be overriden with this method.

Parameters

string $file : Relative path of the file to override, for example: `forum/Hero.less`
string $newFilePath : Absolute path of the new file.
string $extensionId : If overriding an extension file, specify its ID, for example: `flarum-tags`.

Return Value

Theme

Theme overrideFileSource(string $file, string $newFilePath, string $extensionId = null)

This method allows overriding LESS file sources.

For example `forum.less`, `admin.less`, `mixins.less` and `variables.less` are file sources, and can therefore be overriden using this method.

Parameters

string $file : Name of the file to override, for example: `admin.less`
string $newFilePath : Absolute path of the new file.
string $extensionId : If overriding an extension file, specify its ID, for example: `flarum-tags`.

Return Value

Theme

Theme addCustomLessFunction(string $functionName, callable $callable)

This method allows you to add custom Less functions.

All custom Less functions may only return numbers, strings or booleans. **Example usage:** ```php (new Extend\Theme) ->addCustomLessFunction('is-flarum', function (mixed $text) { return strtolower($text) === 'flarum' }), ```

Parameters

string $functionName Name of the function identifier.
callable $callable The PHP function to run when the Less function is called.

Return Value

Theme

See also

https://leafo.net/lessphp/docs/#custom_functions

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

Parameters

Container $container
Extension $extension