Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProductActions.php
Go to the documentation of this file.
1 <?php
7 
12 
19 class ProductActions extends Column
20 {
24  protected $urlBuilder;
25 
33  public function __construct(
37  array $components = [],
38  array $data = []
39  ) {
40  $this->urlBuilder = $urlBuilder;
41  parent::__construct($context, $uiComponentFactory, $components, $data);
42  }
43 
50  public function prepareDataSource(array $dataSource)
51  {
52  if (isset($dataSource['data']['items'])) {
53  $storeId = $this->context->getFilterParam('store_id');
54 
55  foreach ($dataSource['data']['items'] as &$item) {
56  $item[$this->getData('name')]['edit'] = [
57  'href' => $this->urlBuilder->getUrl(
58  'catalog/product/edit',
59  ['id' => $item['entity_id'], 'store' => $storeId]
60  ),
61  'label' => __('Edit'),
62  'hidden' => false,
63  ];
64  }
65  }
66 
67  return $dataSource;
68  }
69 }
__()
Definition: __.php:13
__construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, UrlInterface $urlBuilder, array $components=[], array $data=[])