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.     public function getAlias()
  21.     {
  22.         return 'uvdesk';
  23.     }
  24.     public function getConfiguration(array $configsContainerBuilder $container)
  25.     {
  26.         return new BundleConfiguration();
  27.     }
  28.     public function load(array $configsContainerBuilder $container)
  29.     {
  30.         $services = new YamlFileLoader($container, new FileLocator(__DIR__ '/../Resources/config/services'));
  31.         $services->load('core.yaml');
  32.         $services->load('public.yaml');
  33.         // Register automations conditionally if AutomationBundle has been added as an dependency.
  34.         if (array_key_exists('UVDeskAutomationBundle'$container->getParameter('kernel.bundles'))) {
  35.             $services->load('automations.yaml');
  36.         }
  37.         // Load bundle configurations
  38.         $configuration $this->getConfiguration($configs$container);
  39.         foreach ($this->processConfiguration($configuration$configs) as $param => $value) {
  40.             switch ($param) {
  41.                 case 'upload_manager':
  42.                     foreach ($value as $field => $fieldValue) {
  43.                         $container->setParameter("uvdesk.$param.$field"$fieldValue);
  44.                     }
  45.                     break;
  46.                 case 'default':
  47.                     foreach ($value as $defaultItem => $defaultItemValue) {
  48.                         switch ($defaultItem) {
  49.                             case 'templates':
  50.                                 foreach ($defaultItemValue as $template => $templateValue) {
  51.                                     $container->setParameter("uvdesk.default.templates.$template"$templateValue);
  52.                                 }
  53.                                 break;
  54.                             case 'ticket':
  55.                                 foreach ($defaultItemValue as $option => $optionValue) {
  56.                                     $container->setParameter("uvdesk.default.ticket.$option"$optionValue);
  57.                                 }
  58.                                 break;
  59.                             default:
  60.                                 $container->setParameter("uvdesk.default.$defaultItem"$defaultItemValue);
  61.                                 break;
  62.                         }
  63.                     }
  64.                     break;
  65.                 default:
  66.                     $container->setParameter("uvdesk.$param"$value);
  67.                     
  68.                     break;
  69.             }
  70.         }
  71.         $container->registerForAutoconfiguration(RouterInterface::class)->addTag('routing.loader');
  72.         $container->registerForAutoconfiguration(WidgetInterface::class)->addTag(WidgetInterface::class);
  73.         $container->registerForAutoconfiguration(QuickActionButtonInterface::class)->addTag(QuickActionButtonInterface::class);
  74.         $container->registerForAutoconfiguration(RoutingResourceInterface::class)->addTag(RoutingResourceInterface::class);
  75.         $container->registerForAutoconfiguration(ExtendableComponentInterface::class)->addTag(ExtendableComponentInterface::class);
  76.         // $container->registerForAutoconfiguration(EmbeddableResourceInterface::class)->addTag(EmbeddableResourceInterface::class);
  77.         $container->registerForAutoconfiguration(SearchItemInterface::class)->addTag(SearchItemInterface::class);
  78.         $container->registerForAutoconfiguration(NavigationInterface::class)->addTag(NavigationInterface::class);
  79.         $container->registerForAutoconfiguration(HomepageSectionInterface::class)->addTag(HomepageSectionInterface::class);
  80.         $container->registerForAutoconfiguration(HomepageSectionItemInterface::class)->addTag(HomepageSectionItemInterface::class);
  81.         $container->registerForAutoconfiguration(PanelSidebarInterface::class)->addTag(PanelSidebarInterface::class);
  82.         $container->registerForAutoconfiguration(PanelSidebarItemInterface::class)->addTag(PanelSidebarItemInterface::class);
  83.     }
  84. }