vendor/blackbit/data-director/BlackbitDataDirectorBundle.php line 23

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright Blackbit digital Commerce GmbH <info@blackbit.de>
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  8.  *
  9.  * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  10.  */
  11. namespace Blackbit\DataDirectorBundle;
  12. use Blackbit\DataDirectorBundle\lib\Pim\Logger\Logger;
  13. use Blackbit\DataDirectorBundle\Tools\Installer;
  14. use Pimcore\Db;
  15. use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
  16. use Pimcore\Extension\Bundle\Installer\InstallerInterface;
  17. use Pimcore\Extension\Bundle\PimcoreBundleAdminClassicInterface;
  18. use Pimcore\Extension\Bundle\Traits\BundleAdminClassicTrait;
  19. use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
  20. class BlackbitDataDirectorBundle extends AbstractPimcoreBundle implements PimcoreBundleAdminClassicInterface
  21. {
  22.     use PackageVersionTrait {
  23.         getVersion as protected getComposerVersion;
  24.     }
  25.     use BundleAdminClassicTrait;
  26.     /**
  27.      * @return Installer
  28.      */
  29.     public function getInstaller(): ?InstallerInterface
  30.     {
  31.         return $this->container->get(Installer::class);
  32.     }
  33.     /**
  34.      * @return string[]
  35.      */
  36.     public function getJsPaths(): array
  37.     {
  38.         return self::getClientLibraryPaths()['js'];
  39.     }
  40.     public function getEditmodeJsPaths(): array
  41.     {
  42.         return ['/bundles/blackbitdatadirector/js/editMode.js'];
  43.     }
  44.     public static function getClientLibraryPaths() {
  45.         $jsPaths = [
  46.             '/bundles/blackbitdatadirector/js/portlets/queueMonitor.js',
  47.             '/bundles/blackbitdatadirector/js/portlets/errorMonitor.js',
  48.             '/bundles/blackbitdatadirector/js/portlets/taggedElements.js',
  49.             '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/data.js',
  50.             '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/tag.js',
  51.             '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/data.js',
  52.             '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/tag.js',
  53.             '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/data.js',
  54.             '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/tag.js',
  55.             '/bundles/blackbitdatadirector/js/fieldType/dataportButton/data.js',
  56.             '/bundles/blackbitdatadirector/js/fieldType/dataportButton/tag.js',
  57.             '/bundles/blackbitdatadirector/js/fieldType/htmlContainer/data.js',
  58.             '/bundles/blackbitdatadirector/js/fieldType/htmlContainer/tag.js',
  59.             '/bundles/blackbitdatadirector/js/ImportConfig.js',
  60.             '/bundles/blackbitdatadirector/js/plugin.js',
  61.             '/bundles/blackbitdatadirector/js/components/DataportPanel.js',
  62.             '/bundles/blackbitdatadirector/js/components/DataportPreview.js',
  63.             '/bundles/blackbitdatadirector/js/components/ManualImport.js',
  64.             '/bundles/blackbitdatadirector/js/components/MappingPanel.js',
  65.             '/bundles/blackbitdatadirector/js/gridOperatorDataQuerySelector.js',
  66.             '/bundles/blackbitdatadirector/js/gridExport.js',
  67.             '/bundles/blackbitdatadirector/js/gridExportCsv.js',
  68.             '/bundles/blackbitdatadirector/js/gridExportXml.js',
  69.             '/bundles/blackbitdatadirector/js/gridExportJson.js',
  70.             '/bundles/blackbitdatadirector/js/reportAdapter.js',
  71.             '/bundles/blackbitdatadirector/js/components/VersionPanel.js',
  72.         ];
  73.         if (!file_exists(PIMCORE_WEB_ROOT.'/bundles/pimcoreadmin/js/lib/ace')) {
  74.             $jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ace.js';
  75.         }
  76.         $jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ext-language_tools.js';
  77.         return [
  78.             'css' => [
  79.                 '/bundles/blackbitdatadirector/css/pim.css',
  80.                 '/bundles/blackbitdatadirector/vendor/php-diff/diff-table.css',
  81.                 '/BlackbitDataDirector/translation-language-icons'
  82.             ],
  83.             'js' => $jsPaths
  84.         ];
  85.     }
  86.     /**
  87.      * @return string[]
  88.      */
  89.     public function getCssPaths(): array
  90.     {
  91.         return self::getClientLibraryPaths()['css'];
  92.     }
  93.     /**
  94.      * Returns the composer package name used to resolve the version
  95.      *
  96.      * @return string
  97.      */
  98.     protected function getComposerPackageName(): string
  99.     {
  100.         return 'blackbit/data-director';
  101.     }
  102.     /**
  103.      * @return string
  104.      */
  105.     public function getVersion(): string
  106.     {
  107.         try {
  108.             return $this->getComposerVersion();
  109.         } catch (\Exception $e) {
  110.             return 'unknown';
  111.         }
  112.     }
  113. }