/** * Register a hook subscriber bundle. * * @param ProviderBundle $bundle HookProviderBundle. * * @return AbstractContainer */ public function registerHookProviderBundle(ProviderBundle $bundle) { if (array_key_exists($bundle->getArea(), $this->providerBundles)) { throw new \InvalidArgumentException(sprintf('Area %s is already registered', $bundle->getArea())); } $this->providerBundles[$bundle->getArea()] = $bundle; return $this; }
/** * Define the hook bundles supported by this module. * * @return void */ protected function setupHookBundles() { $bundle = new SubscriberBundle('KaikmediaGalleryModule', 'subscriber.kaikmediagallery.ui_hooks.media', 'ui_hooks', $this->__('Media Hooks')); $bundle->addEvent('display_view', 'kaikmediagallery.ui_hooks.media.display_view'); $bundle->addEvent('form_edit', 'kaikmediagallery.ui_hooks.media.form_edit'); $bundle->addEvent('form_delete', 'kaikmediagallery.ui_hooks.media.form_delete'); $bundle->addEvent('validate_edit', 'kaikmediagallery.ui_hooks.media.validate_edit'); $bundle->addEvent('validate_delete', 'kaikmediagallery.ui_hooks.media.validate_delete'); $bundle->addEvent('process_edit', 'kaikmediagallery.ui_hooks.media.process_edit'); $bundle->addEvent('process_delete', 'kaikmediagallery.ui_hooks.media.process_delete'); $this->registerHookSubscriberBundle($bundle); $bundle = new SubscriberBundle('KaikmediaGalleryModule', 'subscriber.kaikmediagallery.filter_hooks.mediafilter', 'filter_hooks', $this->__('Gallery Filter Hooks')); $bundle->addEvent('filter', 'kaikmediagallery.filter_hooks.media.filter'); $this->registerHookSubscriberBundle($bundle); $bundle = new ProviderBundle('KaikmediaGalleryModule', 'provider.kaikmediagallery.ui_hooks.media', 'ui_hooks', $this->__('KMGallery media provider')); $bundle->addServiceHandler('display_view', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'uiView', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('form_edit', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'uiEdit', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('form_delete', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'uiDelete', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('validate_edit', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'validateEdit', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('validate_delete', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'validateDelete', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('process_edit', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'processEdit', 'kaikmediagallery.hooks.media'); $bundle->addServiceHandler('process_delete', 'Kaikmedia\\GalleryModule\\Hook\\MediaHandlers', 'processDelete', 'kaikmediagallery.hooks.media'); $this->registerHookProviderBundle($bundle); }
/** * Unregister a provider bundle with persistence. * * @param ProviderBundle $bundle */ public function unregisterProviderBundle(ProviderBundle $bundle) { $this->storage->unregisterProviderByArea($bundle->getArea()); $this->reload(); }