Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SynonymActions.php
Go to the documentation of this file.
1 <?php
8 
13 
17 class SynonymActions extends Column
18 {
20  const SYNONYM_URL_PATH_DELETE = 'search/synonyms/delete';
21  const SYNONYM_URL_PATH_EDIT = 'search/synonyms/edit';
22 
26  protected $urlBuilder;
27 
35  public function __construct(
39  array $components = [],
40  array $data = []
41  ) {
42  $this->urlBuilder = $urlBuilder;
43  parent::__construct($context, $uiComponentFactory, $components, $data);
44  }
45 
52  public function prepareDataSource(array $dataSource)
53  {
54  if (isset($dataSource['data']['items'])) {
55  foreach ($dataSource['data']['items'] as & $item) {
56  $name = $this->getData('name');
57  $item[$name]['delete'] = [
58  'href' => $this->urlBuilder->getUrl(
59  self::SYNONYM_URL_PATH_DELETE,
60  ['group_id' => $item['group_id']]
61  ),
62  'label' => __('Delete'),
63  'confirm' => [
64  'title' => __('Delete'),
65  'message' => __('Are you sure you want to delete synonym group with id: %1?', $item['group_id'])
66  ]
67  ];
68  $item[$name]['edit'] = [
69  'href' => $this->urlBuilder->getUrl(self::SYNONYM_URL_PATH_EDIT, ['group_id' => $item['group_id']]),
70  'label' => __('View/Edit'),
71  ];
72  }
73  }
74 
75  return $dataSource;
76  }
77 }
__()
Definition: __.php:13
__construct(ContextInterface $context, UiComponentFactory $uiComponentFactory, UrlInterface $urlBuilder, array $components=[], array $data=[])
if(!isset($_GET['name'])) $name
Definition: log.php:14