|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license GPLv3, http://www.gnu.org/copyleft/gpl.html |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2017 |
|
6
|
|
|
* @package TYPO3 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
namespace Aimeos\Aimeos\Flexform; |
|
11
|
|
|
|
|
12
|
|
|
use Aimeos\Aimeos\Base; |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Aimeos attribute flexform helper |
|
17
|
|
|
* |
|
18
|
|
|
* @package TYPO3 |
|
19
|
|
|
*/ |
|
20
|
|
|
class Attribute |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* Returns the list of attribute types with their ID |
|
24
|
|
|
* |
|
25
|
|
|
* @param array $config Associative array of existing configurations |
|
26
|
|
|
* @param \TYPO3\CMS\Backend\Form\FormEngine|\TYPO3\CMS\Backend\Form\DataPreprocessor $tceForms TCE forms object |
|
|
|
|
|
|
27
|
|
|
* @param string $sitecode Unique code of the site to retrieve the categories for |
|
28
|
|
|
* @return array Associative array with existing and new entries |
|
29
|
|
|
*/ |
|
30
|
|
|
public function getTypes(array $config, $tceForms = null, string $sitecode = 'default') : array |
|
31
|
|
|
{ |
|
32
|
|
|
try { |
|
33
|
|
|
if (!isset($config['flexParentDatabaseRow']['pid'])) { |
|
34
|
|
|
throw new \Exception('No PID found in "flexParentDatabaseRow" or "row" array key: ' . print_r($config, true)); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
$pid = $config['flexParentDatabaseRow']['pid']; |
|
38
|
|
|
$pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); |
|
39
|
|
|
|
|
40
|
|
|
if (isset($pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site'])) { |
|
41
|
|
|
$sitecode = $pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site']; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
$context = Base::context(Base::config()); |
|
45
|
|
|
$context->setEditor('flexform'); |
|
46
|
|
|
|
|
47
|
|
|
$localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
48
|
|
|
$context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); |
|
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
$manager = \Aimeos\MShop::create($context, 'attribute/type'); |
|
51
|
|
|
$items = $manager->search($manager->filter(true)); |
|
52
|
|
|
|
|
53
|
|
|
foreach ($items as $item) { |
|
54
|
|
|
$config['items'][] = [$item->getName(), $item->getCode()]; |
|
55
|
|
|
} |
|
56
|
|
|
} catch(\Exception $e) { |
|
57
|
|
|
error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return $config; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths