1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* MagePrince |
4
|
|
|
* |
5
|
|
|
* NOTICE OF LICENSE |
6
|
|
|
* |
7
|
|
|
* This source file is subject to the mageprince.com license that is |
8
|
|
|
* available through the world-wide-web at this URL: |
9
|
|
|
* https://mageprince.com/end-user-license-agreement |
10
|
|
|
* |
11
|
|
|
* DISCLAIMER |
12
|
|
|
* |
13
|
|
|
* Do not edit or add to this file if you wish to upgrade this extension to newer |
14
|
|
|
* version in the future. |
15
|
|
|
* |
16
|
|
|
* @category MagePrince |
17
|
|
|
* @package Mageprince_Faq |
18
|
|
|
* @copyright Copyright (c) MagePrince (https://mageprince.com/) |
19
|
|
|
* @license https://mageprince.com/end-user-license-agreement |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Mageprince\Faq\Ui\Component\Listing\Column; |
23
|
|
|
|
24
|
|
|
use Magento\Backend\Model\UrlInterface; |
|
|
|
|
25
|
|
|
use Magento\Framework\Exception\NoSuchEntityException; |
|
|
|
|
26
|
|
|
use Magento\Framework\View\Asset\Repository; |
|
|
|
|
27
|
|
|
use Magento\Framework\View\Element\UiComponent\ContextInterface; |
|
|
|
|
28
|
|
|
use Magento\Framework\View\Element\UiComponentFactory; |
|
|
|
|
29
|
|
|
use Magento\Store\Model\StoreManagerInterface; |
|
|
|
|
30
|
|
|
use Magento\Ui\Component\Listing\Columns\Column; |
|
|
|
|
31
|
|
|
|
32
|
|
|
class GroupIcon extends Column |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* @var StoreManagerInterface |
36
|
|
|
*/ |
37
|
|
|
protected $storeManager; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var Repository |
41
|
|
|
*/ |
42
|
|
|
protected $assetRepo; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var UrlInterface |
46
|
|
|
*/ |
47
|
|
|
protected $_backendUrl; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* GroupIcon constructor. |
51
|
|
|
* @param ContextInterface $context |
52
|
|
|
* @param UiComponentFactory $uiComponentFactory |
53
|
|
|
* @param StoreManagerInterface $storeManager |
54
|
|
|
* @param Repository $assetRepo |
55
|
|
|
* @param UrlInterface $backendUrl |
56
|
|
|
* @param array $components |
57
|
|
|
* @param array $data |
58
|
|
|
*/ |
59
|
|
|
public function __construct( |
60
|
|
|
ContextInterface $context, |
61
|
|
|
UiComponentFactory $uiComponentFactory, |
62
|
|
|
StoreManagerInterface $storeManager, |
63
|
|
|
Repository $assetRepo, |
64
|
|
|
UrlInterface $backendUrl, |
65
|
|
|
array $components = [], |
66
|
|
|
array $data = [] |
67
|
|
|
) { |
68
|
|
|
parent::__construct($context, $uiComponentFactory, $components, $data); |
69
|
|
|
$this->storeManager = $storeManager; |
70
|
|
|
$this->assetRepo = $assetRepo; |
71
|
|
|
$this->_backendUrl = $backendUrl; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Prepare Data Source |
76
|
|
|
* |
77
|
|
|
* @param array $dataSource |
78
|
|
|
* @return array |
79
|
|
|
* @throws NoSuchEntityException |
80
|
|
|
*/ |
81
|
|
|
public function prepareDataSource(array $dataSource) |
82
|
|
|
{ |
83
|
|
|
if (isset($dataSource['data']['items'])) { |
84
|
|
|
$path = $this->storeManager->getStore()->getBaseUrl( |
85
|
|
|
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA |
|
|
|
|
86
|
|
|
) . 'faq/tmp/icon/'; |
87
|
|
|
$baseImage = $this->assetRepo->getUrl('Mageprince_Faq::images/faq.png'); |
88
|
|
|
$fieldName = $this->getData('name'); |
89
|
|
|
foreach ($dataSource['data']['items'] as & $item) { |
90
|
|
|
if ($item[$fieldName]) { |
91
|
|
|
$item[$fieldName . '_src'] = $path . $item['icon']; |
92
|
|
|
$item[$fieldName . '_alt'] = $item['groupname']; |
93
|
|
|
$item[$fieldName . '_orig_src'] = $path . $item['icon']; |
94
|
|
|
} else { |
95
|
|
|
$item[$fieldName . '_src'] = $baseImage; |
96
|
|
|
$item[$fieldName . '_alt'] = 'Faq'; |
97
|
|
|
$item[$fieldName . '_orig_src'] = $baseImage; |
98
|
|
|
} |
99
|
|
|
$item[$fieldName . '_link'] = $this->_backendUrl->getUrl( |
100
|
|
|
"mageprince_faq/faqgroup/edit", |
101
|
|
|
['faqgroup_id' => $item['faqgroup_id']] |
102
|
|
|
); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
return $dataSource; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
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