Crud\Controller\Component\CrudComponent::on PHP Method

on() public method

Attaches an event listener function to the controller for Crud Events.
public on ( string | array $events, callback $callback, array $options = [] ) : void
$events string | array Name of the Crud Event you want to attach to controller.
$callback callback Callable method or closure to be executed on event.
$options array Used to set the `priority` and `passParams` flags to the listener.
return void
    public function on($events, $callback, $options = [])
    {
        foreach ((array) $events as $event) {
            if (!strpos($event, '.')) {
                $event = $this->_config['eventPrefix'] . '.' . $event;
            }
            $this->_eventManager->on($event, $options, $callback);
        }
    }