* @package chamilo.plugin.createDrupalUser */ class CreateDrupalUser extends Plugin implements HookPluginInterface { /** * Class constructor */ protected function __construct() { $parameters = array( 'drupal_domain' => 'text' ); parent::__construct('1.0', 'Angel Fernando Quiroz Campos', $parameters); } /** * Instance the plugin * @staticvar null $result * @return CreateDrupalUser */ static function create() { static $result = null; return $result ? $result : $result = new self(); } /** * Install the plugin */ public function install() { $this->installHook(); } /** * Uninstall the plugin * @return void */ public function uninstall() { $this->uninstallHook(); } /** * Install the Create User hook */ public function installHook() { /** @var HookCreateDrupalUser $observer */ $observer = HookCreateDrupalUser::create(); HookCreateUser::create()->attach($observer); } /** * Uninstall the Create User hook */ public function uninstallHook() { /** @var HookCreateDrupalUser $observer */ $observer = HookCreateDrupalUser::create(); $event = HookCreateUser::create(); if ($event) { $event->detach($observer); } } }