init
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_Core
|
||||
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\Core\Ui\Component\Listing\Columns;
|
||||
|
||||
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 Statuses 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'])) {
|
||||
$availableOptions = $this->getOptions()->toOptionArray();
|
||||
foreach ($dataSource['data']['items'] as &$item) {
|
||||
foreach ($availableOptions as $k => $status) {
|
||||
if (!isset($item['is_active'])) {
|
||||
$item['is_active'] = 0;
|
||||
}
|
||||
if ($status['value'] == $item['is_active'] && is_numeric($item['is_active'])) {
|
||||
$item['is_active'] = '<span class="mgz-status mgz-status_' . $status['value'] . '">' . $status['label'] . '</span>';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $dataSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_Core
|
||||
* @copyright Copyright (C) 2019 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\Core\Ui\DataProvider\Form;
|
||||
|
||||
use Magento\Framework\App\ObjectManager;
|
||||
use Magezon\Core\Framework\Stdlib\ArrayManager;
|
||||
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
|
||||
|
||||
class AbstractModifier extends \Magento\Ui\DataProvider\AbstractDataProvider
|
||||
{
|
||||
const META_CONFIG_PATH = '/arguments/data/config';
|
||||
|
||||
/**
|
||||
* Container fieldset prefix
|
||||
*/
|
||||
const CONTAINER_PREFIX = 'container_';
|
||||
|
||||
/**
|
||||
* @var ArrayManager
|
||||
*/
|
||||
private $arrayManager;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $fileInfo;
|
||||
|
||||
/**
|
||||
* @var ScopeOverriddenValue
|
||||
*/
|
||||
private $scopeOverriddenValue;
|
||||
|
||||
/**
|
||||
* Retrieve array manager
|
||||
*
|
||||
* @return ArrayManager
|
||||
*/
|
||||
protected function getArrayManager()
|
||||
{
|
||||
if (null === $this->arrayManager) {
|
||||
$this->arrayManager = ObjectManager::getInstance()->get(
|
||||
ArrayManager::class
|
||||
);
|
||||
}
|
||||
return $this->arrayManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get FileInfo instance
|
||||
*
|
||||
* @return FileInfo
|
||||
*/
|
||||
protected function getFileInfo()
|
||||
{
|
||||
if ($this->fileInfo === null) {
|
||||
$this->fileInfo = ObjectManager::getInstance()->get(\Magezon\Core\Model\FileInfo::class);
|
||||
}
|
||||
return $this->fileInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve scope overridden value
|
||||
*
|
||||
* @return ScopeOverriddenValue
|
||||
*/
|
||||
protected function getScopeOverriddenValue()
|
||||
{
|
||||
if (null === $this->scopeOverriddenValue) {
|
||||
$this->scopeOverriddenValue = ObjectManager::getInstance()->get(
|
||||
ScopeOverriddenValue::class
|
||||
);
|
||||
}
|
||||
|
||||
return $this->scopeOverriddenValue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user