vendor/pimcore/data-hub/src/PimcoreDataHubBundle.php line 30

Open in your IDE?
  1. <?php
  2. /**
  3. * Pimcore
  4. *
  5. * This source file is available under two different licenses:
  6. * - GNU General Public License version 3 (GPLv3)
  7. * - Pimcore Commercial License (PCL)
  8. * Full copyright and license information is available in
  9. * LICENSE.md which is distributed with this source code.
  10. *
  11. * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12. * @license http://www.pimcore.org/license GPLv3 and PCL
  13. */
  14. namespace Pimcore\Bundle\DataHubBundle;
  15. use Pimcore\Bundle\AdminBundle\PimcoreAdminBundle;
  16. use Pimcore\Bundle\DataHubBundle\DependencyInjection\Compiler\CustomDocumentTypePass;
  17. use Pimcore\Bundle\DataHubBundle\DependencyInjection\Compiler\ImportExportLocatorsPass;
  18. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  19. use Pimcore\Extension\Bundle\Installer\InstallerInterface;
  20. use Pimcore\Extension\Bundle\PimcoreBundleAdminClassicInterface;
  21. use Pimcore\Extension\Bundle\Traits\BundleAdminClassicTrait;
  22. use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
  23. use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
  24. use Pimcore\HttpKernel\BundleCollection\BundleCollection;
  25. use Symfony\Component\DependencyInjection\ContainerBuilder;
  26. class PimcoreDataHubBundle extends AbstractPimcoreBundle implements PimcoreBundleAdminClassicInterface, DependentBundleInterface
  27. {
  28. use BundleAdminClassicTrait;
  29. use PackageVersionTrait;
  30. const RUNTIME_CONTEXT_KEY = 'datahub_context';
  31. const NOT_ALLOWED_POLICY_EXCEPTION = 1;
  32. const NOT_ALLOWED_POLICY_NULL = 2;
  33. //TODO decide whether we want to return null here or throw an exception (maybe make this configurable?)
  34. public static $notAllowedPolicy = self::NOT_ALLOWED_POLICY_NULL;
  35. public function build(ContainerBuilder $container)
  36. {
  37. $container->addCompilerPass(new ImportExportLocatorsPass());
  38. $container->addCompilerPass(new CustomDocumentTypePass());
  39. }
  40. public static function registerDependentBundles(BundleCollection $collection): void
  41. {
  42. $collection->addBundle(new PimcoreAdminBundle(), 60);
  43. }
  44. protected function getComposerPackageName(): string
  45. {
  46. return 'pimcore/data-hub';
  47. }
  48. public function getCssPaths(): array
  49. {
  50. return [
  51. '/bundles/pimcoredatahub/css/icons.css',
  52. '/bundles/pimcoredatahub/css/style.css',
  53. ];
  54. }
  55. public function getJsPaths(): array
  56. {
  57. return [
  58. '/bundles/pimcoredatahub/js/datahub.js',
  59. '/bundles/pimcoredatahub/js/config.js',
  60. '/bundles/pimcoredatahub/js/adapter/abstract.js',
  61. '/bundles/pimcoredatahub/js/adapter/graphql.js',
  62. '/bundles/pimcoredatahub/js/configuration/graphql/configItem.js',
  63. '/bundles/pimcoredatahub/js/fieldConfigDialog.js',
  64. '/bundles/pimcoredatahub/js/Abstract.js',
  65. '/bundles/pimcoredatahub/js/mutationvalue/DefaultValue.js',
  66. '/bundles/pimcoredatahub/js/queryvalue/DefaultValue.js',
  67. '/bundles/pimcoredatahub/js/queryoperator/Alias.js',
  68. '/bundles/pimcoredatahub/js/queryoperator/Concatenator.js',
  69. '/bundles/pimcoredatahub/js/queryoperator/DateFormatter.js',
  70. '/bundles/pimcoredatahub/js/queryoperator/ElementCounter.js',
  71. '/bundles/pimcoredatahub/js/queryoperator/Text.js',
  72. '/bundles/pimcoredatahub/js/queryoperator/Merge.js',
  73. '/bundles/pimcoredatahub/js/queryoperator/Substring.js',
  74. '/bundles/pimcoredatahub/js/queryoperator/Thumbnail.js',
  75. '/bundles/pimcoredatahub/js/queryoperator/ThumbnailHtml.js',
  76. '/bundles/pimcoredatahub/js/queryoperator/TranslateValue.js',
  77. '/bundles/pimcoredatahub/js/queryoperator/Trimmer.js',
  78. '/bundles/pimcoredatahub/js/mutationoperator/mutationoperator.js',
  79. '/bundles/pimcoredatahub/js/mutationoperator/IfEmpty.js',
  80. '/bundles/pimcoredatahub/js/mutationoperator/LocaleSwitcher.js',
  81. '/bundles/pimcoredatahub/js/mutationoperator/LocaleCollector.js',
  82. '/bundles/pimcoredatahub/js/workspace/abstract.js',
  83. '/bundles/pimcoredatahub/js/workspace/document.js',
  84. '/bundles/pimcoredatahub/js/workspace/asset.js',
  85. '/bundles/pimcoredatahub/js/workspace/object.js',
  86. ];
  87. }
  88. /**
  89. * If the bundle has an installation routine, an installer is responsible of handling installation related tasks
  90. *
  91. */
  92. public function getInstaller(): ?InstallerInterface
  93. {
  94. return $this->container->get(Installer::class);
  95. }
  96. /**
  97. * @return int
  98. */
  99. public static function getNotAllowedPolicy()
  100. {
  101. return self::$notAllowedPolicy;
  102. }
  103. /**
  104. * @param mixed $notAllowedPolicy
  105. */
  106. public static function setNotAllowedPolicy($notAllowedPolicy): void
  107. {
  108. self::$notAllowedPolicy = $notAllowedPolicy;
  109. }
  110. }