Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-ui
Component
Form
Element
ColorPicker.php
Go to the documentation of this file.
1
<?php
7
declare(strict_types=1);
8
9
namespace
Magento\Ui\Component\Form\Element
;
10
11
use
Magento\Ui\Model\ColorPicker\ColorModesProvider
;
12
use
Magento\Framework\View\Element\UiComponentFactory
;
13
use
Magento\Framework\View\Element\UiComponentInterface
;
14
use
Magento\Framework\View\Element\UiComponent\ContextInterface
;
15
21
class
ColorPicker
extends
AbstractElement
22
{
23
const
NAME
=
'colorPicker'
;
24
25
const
DEFAULT_MODE
=
'full'
;
26
32
private
$modesProvider;
33
43
public
function
__construct
(
44
ContextInterface
$context
,
45
ColorModesProvider
$modesProvider,
46
array
$components
= [],
47
array
$data
= []
48
) {
49
$this->modesProvider = $modesProvider;
50
parent::__construct(
$context
,
$components
,
$data
);
51
}
52
58
public
function
getComponentName
(): string
59
{
60
return
static::NAME;
61
}
62
68
public
function
prepare
() : void
69
{
70
$modes = $this->modesProvider->getModes();
71
$colorPickerModeSetting = $this->
getData
(
'config/colorPickerMode'
);
72
$colorFormatSetting = $this->
getData
(
'config/colorFormat'
);
73
$colorPickerMode = $modes[$colorPickerModeSetting] ?? $modes[
self::DEFAULT_MODE
];
74
$colorPickerMode[
'preferredFormat'
] = $colorFormatSetting;
75
$this->_data[
'config'
][
'colorPickerConfig'
] = $colorPickerMode;
76
77
parent::prepare();
78
}
79
}
Magento\Framework\View\Element\UiComponentFactory
Definition:
UiComponentFactory.php:29
Magento\Ui\Component\Form\Element\ColorPicker\NAME
const NAME
Definition:
ColorPicker.php:23
Magento\Framework\View\Element\UiComponent\ContextInterface
Definition:
ContextInterface.php:17
Magento\Framework\View\Element\UiComponentInterface
Definition:
UiComponentInterface.php:16
Magento\Ui\Component\AbstractComponent\getData
getData($key='', $index=null)
Definition:
AbstractComponent.php:264
Magento\Ui\Component\Form\Element\ColorPicker\prepare
prepare()
Definition:
ColorPicker.php:68
Magento\Ui\Component\Form\Element\ColorPicker\__construct
__construct(ContextInterface $context, ColorModesProvider $modesProvider, array $components=[], array $data=[])
Definition:
ColorPicker.php:43
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Ui\Component\Form\Element\ColorPicker
Definition:
ColorPicker.php:21
Magento\Ui\Component\AbstractComponent\$context
$context
Definition:
AbstractComponent.php:31
Magento\Ui\Component\AbstractComponent\$components
$components
Definition:
AbstractComponent.php:36
Magento\Ui\Component\Form\Element\ColorPicker\getComponentName
getComponentName()
Definition:
ColorPicker.php:58
Magento\Ui\Component\Form\Element
Definition:
AbstractElement.php:6
Magento\Framework\Data\Form\Element\AbstractElement
Definition:
AbstractElement.php:21
Magento\Ui\Component\Form\Element\ColorPicker\DEFAULT_MODE
const DEFAULT_MODE
Definition:
ColorPicker.php:25
Magento\Ui\Model\ColorPicker\ColorModesProvider
Definition:
ColorModesProvider.php:14