Skip to content

Kirby 5.0.4

deprecated()

Triggers a deprecation warning if debug mode is active

deprecated(string $message): bool

Parameters

Name Type Default
$messagerequired string no default value

Return type

bool

Whether the warning was triggered

This function is used internally by Kirby, but you can also use it in your plugins to trigger deprecation warnings.

Examples

function someFunction()
{
    deprecated('`somefunction()` is deprecated, use `anotherFunction()` instead. `someFunction()` will be removed in version x.x.x');

    return 'something';
}

When a user uses the someFunction() function and debugging is enabled, the message passed as parameter will be shown.