<?php
/**
* Copyright Blackbit digital Commerce GmbH <info@blackbit.de>
*
* 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.
*
* 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.
*
* 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
*/
namespace Blackbit\DataDirectorBundle;
use Blackbit\DataDirectorBundle\lib\Pim\Logger\Logger;
use Blackbit\DataDirectorBundle\Tools\Installer;
use Pimcore\Db;
use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
use Pimcore\Extension\Bundle\Installer\InstallerInterface;
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
class BlackbitDataDirectorBundle extends AbstractPimcoreBundle
{
use PackageVersionTrait {
getVersion as protected getComposerVersion;
}
/**
* @return Installer
*/
public function getInstaller(): ?InstallerInterface
{
return $this->container->get(Installer::class);
}
/**
* @return string[]
*/
public function getJsPaths()
{
return self::getClientLibraryPaths()['js'];
}
public static function getClientLibraryPaths() {
$jsPaths = [
'/bundles/blackbitdatadirector/js/portlets/queueMonitor.js',
'/bundles/blackbitdatadirector/js/portlets/errorMonitor.js',
'/bundles/blackbitdatadirector/js/portlets/taggedElements.js',
'/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/data.js',
'/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/tag.js',
'/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/data.js',
'/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/tag.js',
'/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/data.js',
'/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/tag.js',
'/bundles/blackbitdatadirector/js/fieldType/htmlContainer/data.js',
'/bundles/blackbitdatadirector/js/fieldType/htmlContainer/tag.js',
'/bundles/blackbitdatadirector/js/ImportConfig.js',
'/bundles/blackbitdatadirector/js/plugin.js',
'/bundles/blackbitdatadirector/js/components/DataportPanel.js',
'/bundles/blackbitdatadirector/js/components/DataportPreview.js',
'/bundles/blackbitdatadirector/js/components/ManualImport.js',
'/bundles/blackbitdatadirector/js/components/MappingPanel.js',
'/bundles/blackbitdatadirector/js/gridOperatorDataQuerySelector.js',
'/bundles/blackbitdatadirector/js/gridExport.js',
'/bundles/blackbitdatadirector/js/gridExportCsv.js',
'/bundles/blackbitdatadirector/js/gridExportXml.js',
'/bundles/blackbitdatadirector/js/gridExportJson.js',
'/bundles/blackbitdatadirector/js/reportAdapter.js',
'/bundles/blackbitdatadirector/js/components/VersionPanel.js',
];
if (!file_exists(PIMCORE_WEB_ROOT.'/bundles/pimcoreadmin/js/lib/ace')) {
$jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ace.js';
}
$jsPaths[] = '/bundles/blackbitdatadirector/vendor/ace/ext-language_tools.js';
return [
'css' => [
'/bundles/blackbitdatadirector/css/pim.css',
'/bundles/blackbitdatadirector/vendor/php-diff/diff-table.css',
'/BlackbitDataDirector/translation-language-icons'
],
'js' => $jsPaths
];
}
/**
* @return string[]
*/
public function getCssPaths()
{
return self::getClientLibraryPaths()['css'];
}
/**
* Returns the composer package name used to resolve the version
*
* @return string
*/
protected function getComposerPackageName(): string
{
return 'blackbit/data-director';
}
/**
* @return string
*/
public function getVersion(): string
{
try {
return $this->getComposerVersion();
} catch (\Exception $e) {
return 'unknown';
}
}
}