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 PimcoreBundleAdminClassicInterfaceDependentBundleInterface
  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.     /**
  36.      * @inheritDoc
  37.      */
  38.     public function build(ContainerBuilder $container)
  39.     {
  40.         $container->addCompilerPass(new ImportExportLocatorsPass());
  41.         $container->addCompilerPass(new CustomDocumentTypePass());
  42.     }
  43.     public static function registerDependentBundles(BundleCollection $collection): void
  44.     {
  45.         $collection->addBundle(new PimcoreAdminBundle(), 60);
  46.     }
  47.     /**
  48.      * {@inheritdoc}
  49.      */
  50.     protected function getComposerPackageName(): string
  51.     {
  52.         return 'pimcore/data-hub';
  53.     }
  54.     /**
  55.      * @return array
  56.      */
  57.     public function getCssPaths(): array
  58.     {
  59.         return [
  60.             '/bundles/pimcoredatahub/css/icons.css',
  61.             '/bundles/pimcoredatahub/css/style.css'
  62.         ];
  63.     }
  64.     /**
  65.      * @return array
  66.      */
  67.     public function getJsPaths(): array
  68.     {
  69.         return [
  70.             '/bundles/pimcoredatahub/js/datahub.js',
  71.             '/bundles/pimcoredatahub/js/config.js',
  72.             '/bundles/pimcoredatahub/js/adapter/graphql.js',
  73.             '/bundles/pimcoredatahub/js/configuration/graphql/configItem.js',
  74.             '/bundles/pimcoredatahub/js/fieldConfigDialog.js',
  75.             '/bundles/pimcoredatahub/js/Abstract.js',
  76.             '/bundles/pimcoredatahub/js/mutationvalue/DefaultValue.js',
  77.             '/bundles/pimcoredatahub/js/queryvalue/DefaultValue.js',
  78.             '/bundles/pimcoredatahub/js/queryoperator/Alias.js',
  79.             '/bundles/pimcoredatahub/js/queryoperator/Concatenator.js',
  80.             '/bundles/pimcoredatahub/js/queryoperator/DateFormatter.js',
  81.             '/bundles/pimcoredatahub/js/queryoperator/ElementCounter.js',
  82.             '/bundles/pimcoredatahub/js/queryoperator/Text.js',
  83.             '/bundles/pimcoredatahub/js/queryoperator/Merge.js',
  84.             '/bundles/pimcoredatahub/js/queryoperator/Substring.js',
  85.             '/bundles/pimcoredatahub/js/queryoperator/Thumbnail.js',
  86.             '/bundles/pimcoredatahub/js/queryoperator/ThumbnailHtml.js',
  87.             '/bundles/pimcoredatahub/js/queryoperator/TranslateValue.js',
  88.             '/bundles/pimcoredatahub/js/queryoperator/Trimmer.js',
  89.             '/bundles/pimcoredatahub/js/mutationoperator/mutationoperator.js',
  90.             '/bundles/pimcoredatahub/js/mutationoperator/IfEmpty.js',
  91.             '/bundles/pimcoredatahub/js/mutationoperator/LocaleSwitcher.js',
  92.             '/bundles/pimcoredatahub/js/mutationoperator/LocaleCollector.js',
  93.             '/bundles/pimcoredatahub/js/workspace/abstract.js',
  94.             '/bundles/pimcoredatahub/js/workspace/document.js',
  95.             '/bundles/pimcoredatahub/js/workspace/asset.js',
  96.             '/bundles/pimcoredatahub/js/workspace/object.js'
  97.         ];
  98.     }
  99.     /**
  100.      * If the bundle has an installation routine, an installer is responsible of handling installation related tasks
  101.      *
  102.      * @return InstallerInterface|null
  103.      */
  104.     public function getInstaller(): ?InstallerInterface
  105.     {
  106.         return $this->container->get(Installer::class);
  107.     }
  108.     /**
  109.      * @return int
  110.      */
  111.     public static function getNotAllowedPolicy()
  112.     {
  113.         return self::$notAllowedPolicy;
  114.     }
  115.     /**
  116.      * @param mixed $notAllowedPolicy
  117.      */
  118.     public static function setNotAllowedPolicy($notAllowedPolicy): void
  119.     {
  120.         self::$notAllowedPolicy $notAllowedPolicy;
  121.     }
  122. }