-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba0e8d4
commit 791a1d4
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 4/5/17 11:19 AM | ||
* @file: Actions.php | ||
*/ | ||
namespace Ebizmarts\MailChimp\Ui\Component\Stores\Grid\Column; | ||
|
||
use Magento\Framework\View\Element\UiComponent\ContextInterface; | ||
use Magento\Framework\View\Element\UiComponentFactory; | ||
use Magento\Ui\Component\Listing\Columns\Column; | ||
use Magento\Framework\UrlInterface; | ||
|
||
/** | ||
* Class ProductActions | ||
*/ | ||
class Actions extends Column | ||
{ | ||
/** | ||
* @var UrlInterface | ||
*/ | ||
protected $urlBuilder; | ||
|
||
/** | ||
* @param ContextInterface $context | ||
* @param UiComponentFactory $uiComponentFactory | ||
* @param UrlInterface $urlBuilder | ||
* @param array $components | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
ContextInterface $context, | ||
UiComponentFactory $uiComponentFactory, | ||
UrlInterface $urlBuilder, | ||
array $components = [], | ||
array $data = [] | ||
) { | ||
$this->urlBuilder = $urlBuilder; | ||
parent::__construct($context, $uiComponentFactory, $components, $data); | ||
} | ||
|
||
/** | ||
* Prepare Data Source | ||
* | ||
* @param array $dataSource | ||
* @return array | ||
*/ | ||
public function prepareDataSource(array $dataSource) | ||
{ | ||
if (isset($dataSource['data']['items'])) { | ||
$storeId = $this->context->getFilterParam('store_id'); | ||
|
||
foreach ($dataSource['data']['items'] as &$item) { | ||
$item[$this->getData('name')]['edit'] = [ | ||
'href' => $this->urlBuilder->getUrl( | ||
'mailchimp/stores/edit', | ||
['id' => $item['id']] | ||
), | ||
'label' => __('Edit'), | ||
'hidden' => false, | ||
]; | ||
} | ||
} | ||
|
||
return $dataSource; | ||
} | ||
} |