src/Controller/Component/CrudComponent.php
public function addListener($name, $className = null, $config = [])
    {
        if (strpos($name, '.') !== false) {
            list($plugin, $name) = pluginSplit($name);
            $className = $plugin . '.' . Inflector::camelize($name);
        }

        $name = Inflector::variable($name);
        $this->setConfig(sprintf('listeners.%s', $name), compact('className') + $config);
    }
public function addListener($name, $className = null, $config = [])
    {
        if (strpos($name, '.') !== false) {
            list($plugin, $name) = pluginSplit($name);
            $className = $plugin . '.' . Inflector::camelize($name);
        }

        $name = Inflector::variable($name);
        $this->setConfig(sprintf('listeners.%s', $name), compact('className') + $config);
    }
public function addListener ( $ name , $ className = null , $ config = [ ] ) { if ( strpos ( $ name , '.' ) !== false ) { list ( $ plugin , $ name ) = pluginSplit ( $ name ) ; $ className = $ plugin . '.' . Inflector :: camelize ( $ name ) ; } $ name = Inflector :: variable ( $ name ) ; $ this -> setConfig ( sprintf ( 'listeners.%s' , $ name ) , compact ( 'className' ) + $ config ) ; }
Add a new listener to Crud

This will not load or initialize the listener, only lazy-load it.

If `$name` is provided but no `$class` argument, the className will
be derived from the `$name`.

CakePHP Plugin.ClassName format for `$name` and `$class` is supported.

@param string $name Name
@param string $className Normal CakePHP plugin-dot annotation supported.
@param array $config Any default settings for a listener.
@return void
Add a new listener to Crud