This documentation describes unreleased changes on the main branch.

Callback

Class. It implements Permission.

use Saij\WpAppFramework\Rest\Permission\Callback;

A public static method decides, passed as first-class callable: new Callback(self::canEdit(...)).

The method returns bool. Its parameters follow the rules of the route method: services are injected, WP_REST_Request receives the request, all other parameters must be request arguments of the route with the same name and type. It runs as permission_callback, after WordPress validated and sanitized the arguments. Static, because PHP allows first-class callables in attribute arguments only for static methods.

Constructor

new Callback(Closure $callback)
ParameterTypeDefaultDescription
callbackClosurerequiredA first-class callable of a public static method that returns bool, e.g. self::canEdit(...).

Methods

getCallback()

getCallback(): Closure

The callable that decides.

Returns Closure