ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_GoogleMap
|
||||
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
namespace Olegnax\GoogleMap\Ui\Component\Form\Field;
|
||||
|
||||
use Magento\Ui\Component\Form\Field;
|
||||
|
||||
if (class_exists('\Magento\Store\Ui\Component\Form\Field\StoreView')) {
|
||||
class StoreView extends \Magento\Store\Ui\Component\Form\Field\StoreView
|
||||
{
|
||||
|
||||
}
|
||||
} else {
|
||||
class StoreView extends Field
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Olegnax
|
||||
* @package Olegnax_GoogleMap
|
||||
* @copyright Copyright (c) 2020 Olegnax (http://olegnax.com/). All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Olegnax\GoogleMap\Ui\Component\Listing\Column;
|
||||
|
||||
use Magento\Framework\UrlInterface;
|
||||
use Magento\Framework\View\Element\UiComponent\ContextInterface;
|
||||
use Magento\Framework\View\Element\UiComponentFactory;
|
||||
use Magento\Ui\Component\Listing\Columns\Column;
|
||||
|
||||
class LocationActions extends Column
|
||||
{
|
||||
|
||||
const URL_PATH_DETAILS = 'olegnax_googlemap/location/details';
|
||||
const URL_PATH_EDIT = 'olegnax_googlemap/location/edit';
|
||||
const URL_PATH_DELETE = 'olegnax_googlemap/location/delete';
|
||||
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'])) {
|
||||
foreach ($dataSource['data']['items'] as & $item) {
|
||||
if (isset($item['location_id'])) {
|
||||
$item[$this->getData('name')] = [
|
||||
'edit' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_EDIT,
|
||||
[
|
||||
'location_id' => $item['location_id'],
|
||||
]
|
||||
),
|
||||
'label' => __('Edit'),
|
||||
],
|
||||
'delete' => [
|
||||
'href' => $this->urlBuilder->getUrl(
|
||||
static::URL_PATH_DELETE,
|
||||
[
|
||||
'location_id' => $item['location_id'],
|
||||
]
|
||||
),
|
||||
'label' => __('Delete'),
|
||||
'confirm' => [
|
||||
'title' => __('Delete "${ $.$data.title }"'),
|
||||
'message' => __('Are you sure you wan\'t to delete a "${ $.$data.title }" record?'),
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dataSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Olegnax\GoogleMap\Ui\Component\Listing\Column;
|
||||
|
||||
use Magento\Store\Ui\Component\Listing\Column\Store;
|
||||
|
||||
class LocationStore extends Store
|
||||
{
|
||||
/**
|
||||
* @param array $item
|
||||
* @return string
|
||||
*/
|
||||
protected function prepareItem(array $item)
|
||||
{
|
||||
$item[$this->storeKey] = empty($item[$this->storeKey]) ? '0' : $item[$this->storeKey];
|
||||
|
||||
if (!is_array($item[$this->storeKey])) {
|
||||
$item[$this->storeKey] = explode(',', $item[$this->storeKey]);
|
||||
}
|
||||
|
||||
return parent::prepareItem($item);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user