DoTrustedCallbackTrait
trait DoTrustedCallbackTrait (View source)
Ensures that TrustedCallbackInterface can be enforced for callback methods.
Methods
mixed
doTrustedCallback(callable $callback, array $args, $message, string $error_type = TrustedCallbackInterface::THROW_EXCEPTION, string $extra_trusted_interface = NULL)
Performs a callback.
Details
mixed
doTrustedCallback(callable $callback, array $args, $message, string $error_type = TrustedCallbackInterface::THROW_EXCEPTION, string $extra_trusted_interface = NULL)
Performs a callback.
If the callback is trusted the callback will occur. Trusted callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or $extra_trusted_interface or be an anonymous function. If the callback is not trusted then whether or not the callback is called and what type of error is thrown depends on $error_type. To provide time for dependent code to use trusted callbacks use TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION and then at a later date change this to TrustedCallbackInterface::THROW_EXCEPTION.