vendor/uvdesk/core-framework/DependencyInjection/CoreFramework.php line 31

Open in your IDE?
  1. <?php
  2. namespace Webkul\UVDesk\CoreFrameworkBundle\DependencyInjection;
  3. use Symfony\Component\Config\FileLocator;
  4. use Symfony\Component\DependencyInjection\ContainerBuilder;
  5. use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  6. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  7. use Webkul\UVDesk\CoreFrameworkBundle\Definition\RouterInterface;
  8. use Webkul\UVDesk\CoreFrameworkBundle\Definition\RoutingResourceInterface;
  9. use Webkul\UVDesk\CoreFrameworkBundle\Framework\ExtendableComponentInterface;
  10. use Webkul\UVDesk\CoreFrameworkBundle\Tickets\WidgetInterface;
  11. use Webkul\UVDesk\CoreFrameworkBundle\Tickets\QuickActionButtonInterface;
  12. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\SearchItemInterface;
  13. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\NavigationInterface;
  14. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\HomepageSectionInterface;
  15. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\HomepageSectionItemInterface;
  16. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\PanelSidebarInterface;
  17. use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\PanelSidebarItemInterface;
  18. class CoreFramework extends Extension
  19. {
  20.     const VERSION 'v1.1.4';
  21.     public function getAlias()
  22.     {
  23.         return 'uvdesk';
  24.     }
  25.     public function getConfiguration(array $configsContainerBuilder $container)
  26.     {
  27.         return new BundleConfiguration();
  28.     }
  29.     public function load(array $configsContainerBuilder $container)
  30.     {
  31.         $services = new YamlFileLoader($container, new FileLocator(__DIR__ '/../Resources/config/services'));
  32.         $services->load('core.yaml');
  33.         $services->load('public.yaml');
  34.         // Register automations conditionally if AutomationBundle has been added as an dependency.
  35.         if (array_key_exists('UVDeskAutomationBundle'$container->getParameter('kernel.bundles'))) {
  36.             $services->load('automations.yaml');
  37.         }
  38.         $container->setParameter("uvdesk.core.version"self::VERSION);
  39.         
  40.         // Load bundle configurations
  41.         $configuration $this->getConfiguration($configs$container);
  42.         foreach ($this->processConfiguration($configuration$configs) as $param => $value) {
  43.             switch ($param) {
  44.                 case 'support_email':
  45.                 case 'upload_manager':
  46.                     foreach ($value as $field => $fieldValue) {
  47.                         $container->setParameter("uvdesk.$param.$field"$fieldValue);
  48.                     }
  49.                     break;
  50.                 case 'default':
  51.                     foreach ($value as $defaultItem => $defaultItemValue) {
  52.                         switch ($defaultItem) {
  53.                             case 'templates':
  54.                                 foreach ($defaultItemValue as $template => $templateValue) {
  55.                                     $container->setParameter("uvdesk.default.templates.$template"$templateValue);
  56.                                 }
  57.                                 break;
  58.                             case 'ticket':
  59.                                 foreach ($defaultItemValue as $option => $optionValue) {
  60.                                     $container->setParameter("uvdesk.default.ticket.$option"$optionValue);
  61.                                 }
  62.                                 break;
  63.                             default:
  64.                                 $container->setParameter("uvdesk.default.$defaultItem"$defaultItemValue);
  65.                                 break;
  66.                         }
  67.                     }
  68.                     break;
  69.                 default:
  70.                     $container->setParameter("uvdesk.$param"$value);
  71.                     break;
  72.             }
  73.         }
  74.         $container->registerForAutoconfiguration(RouterInterface::class)->addTag('routing.loader');
  75.         $container->registerForAutoconfiguration(WidgetInterface::class)->addTag(WidgetInterface::class);
  76.         $container->registerForAutoconfiguration(QuickActionButtonInterface::class)->addTag(QuickActionButtonInterface::class);
  77.         $container->registerForAutoconfiguration(RoutingResourceInterface::class)->addTag(RoutingResourceInterface::class);
  78.         $container->registerForAutoconfiguration(ExtendableComponentInterface::class)->addTag(ExtendableComponentInterface::class);
  79.         // $container->registerForAutoconfiguration(EmbeddableResourceInterface::class)->addTag(EmbeddableResourceInterface::class);
  80.         $container->registerForAutoconfiguration(SearchItemInterface::class)->addTag(SearchItemInterface::class);
  81.         $container->registerForAutoconfiguration(NavigationInterface::class)->addTag(NavigationInterface::class);
  82.         $container->registerForAutoconfiguration(HomepageSectionInterface::class)->addTag(HomepageSectionInterface::class);
  83.         $container->registerForAutoconfiguration(HomepageSectionItemInterface::class)->addTag(HomepageSectionItemInterface::class);
  84.         $container->registerForAutoconfiguration(PanelSidebarInterface::class)->addTag(PanelSidebarInterface::class);
  85.         $container->registerForAutoconfiguration(PanelSidebarItemInterface::class)->addTag(PanelSidebarItemInterface::class);
  86.     }
  87. }