$widget->
setPlugin($this->
Plugin());
$this->
Plugin()->
getWidgets()->
add($widget);
} /**
* {@inheritdoc}
*/
public function subscribeEvent($event,
$listener = null,
$position = null
) { if ($listener === null &&
$event instanceof Enlight_Event_Handler
) { $this->
Collection()->
Subscriber()->
registerListener($event);
} else { parent::
subscribeEvent($event,
$listener,
$position);
} return $this;
} /**
* Helper function to register a plugin controller.
*
* If the default event listener is used for the registration of a plugin controller, the following requirements must be fulfilled:
* 1. The plugin directory must contain a 'Controllers' subdirectory.
* 2. The 'Controllers' directory must contain a subdirectory which corresponds to the module (Frontend, Backend, Widgets or API)
* 3. The controller must be filed in this module directory.
* 4. The controller file must have the same name as the controller class.
*
* If all the requirements are fulfilled, the controller is registered automatically.
* Additionally, the following plugin namespaces/directories are registered, if available:
* 1. The 'Views' plugin directory is added as a template directory.
* 2. The 'Snippets' plugin directory is added as a config directory.
* 3. The 'Components' plugin directory is added as a component namespace.
*
* @example
* <code>
* public function install() {
* $this->registerController('Frontend', 'Example1');
* return true;
* }
* </code>
*
* @param string $module - Possible values: Frontend, Backend, Widgets, Api
* @param string $name - The name of the controller
* @param string $listener - Name of the event listener function which will be called
*
* @throws RuntimeException
*
* @return $this
*/