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 $configs, ContainerBuilder $container)
  26. {
  27. return new BundleConfiguration();
  28. }
  29. public function load(array $configs, ContainerBuilder $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. // Load bundle configurations
  40. $configuration = $this->getConfiguration($configs, $container);
  41. foreach ($this->processConfiguration($configuration, $configs) as $param => $value) {
  42. switch ($param) {
  43. case 'support_email':
  44. case 'upload_manager':
  45. foreach ($value as $field => $fieldValue) {
  46. $container->setParameter("uvdesk.$param.$field", $fieldValue);
  47. }
  48. break;
  49. case 'default':
  50. foreach ($value as $defaultItem => $defaultItemValue) {
  51. switch ($defaultItem) {
  52. case 'templates':
  53. foreach ($defaultItemValue as $template => $templateValue) {
  54. $container->setParameter("uvdesk.default.templates.$template", $templateValue);
  55. }
  56. break;
  57. case 'ticket':
  58. foreach ($defaultItemValue as $option => $optionValue) {
  59. $container->setParameter("uvdesk.default.ticket.$option", $optionValue);
  60. }
  61. break;
  62. default:
  63. $container->setParameter("uvdesk.default.$defaultItem", $defaultItemValue);
  64. break;
  65. }
  66. }
  67. break;
  68. default:
  69. $container->setParameter("uvdesk.$param", $value);
  70. break;
  71. }
  72. }
  73. $container->registerForAutoconfiguration(RouterInterface::class)->addTag('routing.loader');
  74. $container->registerForAutoconfiguration(WidgetInterface::class)->addTag(WidgetInterface::class);
  75. $container->registerForAutoconfiguration(QuickActionButtonInterface::class)->addTag(QuickActionButtonInterface::class);
  76. $container->registerForAutoconfiguration(RoutingResourceInterface::class)->addTag(RoutingResourceInterface::class);
  77. $container->registerForAutoconfiguration(ExtendableComponentInterface::class)->addTag(ExtendableComponentInterface::class);
  78. // $container->registerForAutoconfiguration(EmbeddableResourceInterface::class)->addTag(EmbeddableResourceInterface::class);
  79. $container->registerForAutoconfiguration(SearchItemInterface::class)->addTag(SearchItemInterface::class);
  80. $container->registerForAutoconfiguration(NavigationInterface::class)->addTag(NavigationInterface::class);
  81. $container->registerForAutoconfiguration(HomepageSectionInterface::class)->addTag(HomepageSectionInterface::class);
  82. $container->registerForAutoconfiguration(HomepageSectionItemInterface::class)->addTag(HomepageSectionItemInterface::class);
  83. $container->registerForAutoconfiguration(PanelSidebarInterface::class)->addTag(PanelSidebarInterface::class);
  84. $container->registerForAutoconfiguration(PanelSidebarItemInterface::class)->addTag(PanelSidebarItemInterface::class);
  85. }
  86. }