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

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\Traits\PackageVersionTrait;
  18. class BlackbitDataDirectorBundle extends AbstractPimcoreBundle
  19. {
  20.     use PackageVersionTrait {
  21.         getVersion as protected getComposerVersion;
  22.     }
  23.     /**
  24.      * @return Installer
  25.      */
  26.     public function getInstaller(): ?InstallerInterface
  27.     {
  28.         return $this->container->get(Installer::class);
  29.     }
  30.     /**
  31.      * @return string[]
  32.      */
  33.     public function getJsPaths()
  34.     {
  35.         return self::getClientLibraryPaths()['js'];
  36.     }
  37.     public static function getClientLibraryPaths() {
  38.         $jsPaths = [
  39.             '/bundles/blackbitdatadirector/js/portlets/queueMonitor.js',
  40.             '/bundles/blackbitdatadirector/js/portlets/errorMonitor.js',
  41.             '/bundles/blackbitdatadirector/js/portlets/taggedElements.js',
  42.             '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/data.js',
  43.             '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/tag.js',
  44.             '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/data.js',
  45.             '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/tag.js',
  46.             '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/data.js',
  47.             '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/tag.js',
  48.             '/bundles/blackbitdatadirector/js/fieldType/htmlContainer/data.js',
  49.             '/bundles/blackbitdatadirector/js/fieldType/htmlContainer/tag.js',
  50.             '/bundles/blackbitdatadirector/js/ImportConfig.js',
  51.             '/bundles/blackbitdatadirector/js/plugin.js',
  52.             '/bundles/blackbitdatadirector/js/components/DataportPanel.js',
  53.             '/bundles/blackbitdatadirector/js/components/DataportPreview.js',
  54.             '/bundles/blackbitdatadirector/js/components/ManualImport.js',
  55.             '/bundles/blackbitdatadirector/js/components/MappingPanel.js',
  56.             '/bundles/blackbitdatadirector/js/gridOperatorDataQuerySelector.js',
  57.             '/bundles/blackbitdatadirector/js/gridExport.js',
  58.             '/bundles/blackbitdatadirector/js/gridExportCsv.js',
  59.             '/bundles/blackbitdatadirector/js/gridExportXml.js',
  60.             '/bundles/blackbitdatadirector/js/gridExportJson.js',
  61.             '/bundles/blackbitdatadirector/js/reportAdapter.js',
  62.             '/bundles/blackbitdatadirector/js/components/VersionPanel.js',
  63.         ];
  64.         if (!file_exists(PIMCORE_WEB_ROOT.'/bundles/pimcoreadmin/js/lib/ace')) {
  65.             $jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ace.js';
  66.         }
  67.         $jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ext-language_tools.js';
  68.         return [
  69.             'css' => [
  70.                 '/bundles/blackbitdatadirector/css/pim.css',
  71.                 '/bundles/blackbitdatadirector/vendor/php-diff/diff-table.css',
  72.                 '/BlackbitDataDirector/translation-language-icons'
  73.             ],
  74.             'js' => $jsPaths
  75.         ];
  76.     }
  77.     /**
  78.      * @return string[]
  79.      */
  80.     public function getCssPaths()
  81.     {
  82.         return self::getClientLibraryPaths()['css'];
  83.     }
  84.     /**
  85.      * Returns the composer package name used to resolve the version
  86.      *
  87.      * @return string
  88.      */
  89.     protected function getComposerPackageName(): string
  90.     {
  91.         return 'blackbit/data-director';
  92.     }
  93.     /**
  94.      * @return string
  95.      */
  96.     public function getVersion(): string
  97.     {
  98.         try {
  99.             return $this->getComposerVersion();
  100.         } catch (\Exception $e) {
  101.             return 'unknown';
  102.         }
  103.     }
  104. }