You are here

public function BackendInterface::registerFunction in SCSS Compiler 1.0.x

Register a PHP callback function bridge that can be used in SCSS code.

It is recommended to register all needed functions before the compiler is ran for the first time. If a function is registered after the compiler's first run, then the behavior is undefined.

Parameters

callable $cb: The PHP function to call when bridged from SCSS.

Optional and pass-by-reference parameters aren't supported.

string|null $name: The name of the function as it should be used in the compiled language. This value must be a valid PHP identifier.

Optional unless an anonymous function is supplied (default: NULL).

Throws

\InvalidArgumentException If a bad function name is supplied, or a callback with an optional or pass-by-reference parameter is supplied.

1 method overrides BackendInterface::registerFunction()
BackendBase::registerFunction in src/BackendBase.php
Register a PHP callback function bridge that can be used in SCSS code.

File

src/BackendInterface.php, line 54

Class

BackendInterface
Provides a common interface for backend implementations.

Namespace

Drupal\compiler_scss

Code

public function registerFunction(callable $cb, ?string $name = NULL);