PHP 8.4.26 Released!

Yaf_Dispatcher::registerPlugin

(Yaf >=1.0.0)

Yaf_Dispatcher::registerPlugin — Registra un plugin

Descripción

public function Yaf_Dispatcher::registerPlugin(Yaf_Plugin_Abstract $plugin): Yaf_Dispatcher|null|false

Registra un plugin (véase Yaf_Plugin_Abstract). Generalmente se registran plugins en el Arranque (véase la clase Yaf_Bootstrap_Abstract).

Parámetros

plugin

Una instancia de Yaf_Plugin_Abstract.

Valores devueltos

Devuelve el Yaf_Dispatcher en caso de éxito, or false / null en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de Yaf_Dispatcher::registerPlugin()

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
  public function _initPlugin(Yaf_Dispatcher $dispatcher) {
    /**
    * Yaf asume que los scripts de plugins están en [application.directory] . "/plugins"
    * en este caso, será:
    * [application.directory] . "/plugins/" . "User" . [application.ext]
    */
    $user = new UserPlugin();
    $dispatcher->registerPlugin($user);
  }
}
?>
+add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top