PHP 8.6.0 Beta 3 is available for testing

Yaf_Dispatcher::registerPlugin

(Yaf >=1.0.0)

Yaf_Dispatcher::registerPluginEnregistre un plugin

Description

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

Enregistre un plugin (voir Yaf_Plugin_Abstract). Généralement, les plugins sont enregistrés dans le Bootstrap (voir Yaf_Bootstrap_Abstract).

Liste de paramètres

plugin

Une instance de Yaf_Plugin_Abstract.

Valeurs de retour

Retourne l'objet Yaf_Dispatcher lui-même en cas de succès, ou false / null en cas d'échec.

Exemples

Exemple #1 Exemple avec Yaf_Dispatcher::registerPlugin()

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
  public function _initPlugin(Yaf_Dispatcher $dispatcher) {
    /**
    * Yaf suppose que les scripts de plugin se trouvent dans [application.directory] .  "/plugins"
    * dans ce cas, ce sera :
    * [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