Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
ColorPicker Class Reference
Inheritance diagram for ColorPicker:
AbstractElement AbstractComponent ElementInterface DataObject UiComponentInterface UiComponentInterface BlockInterface BlockInterface

Public Member Functions

 __construct (ContextInterface $context, ColorModesProvider $modesProvider, array $components=[], array $data=[])
 
 getComponentName ()
 
 prepare ()
 
- Public Member Functions inherited from AbstractElement
 getHtmlId ()
 
 getValue ()
 
 getFormInputName ()
 
 isReadonly ()
 
 getCssClasses ()
 
- Public Member Functions inherited from AbstractComponent
 __construct (ContextInterface $context, array $components=[], array $data=[])
 
 getContext ()
 
 getName ()
 
 prepare ()
 
 toHtml ()
 
 render ()
 
 addComponent ($name, UiComponentInterface $component)
 
 getComponent ($name)
 
 getChildComponents ()
 
 renderChildComponent ($name)
 
 getTemplate ()
 
 getConfiguration ()
 
 getJsConfig (UiComponentInterface $component)
 
 setData ($key, $value=null)
 
 getData ($key='', $index=null)
 
 prepareDataSource (array $dataSource)
 
 getDataSourceData ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Data Fields

const NAME = 'colorPicker'
 
const DEFAULT_MODE = 'full'
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractComponent
 prepareChildComponent (UiComponentInterface $component)
 
 initObservers (array & $data=[])
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 
- Protected Attributes inherited from AbstractComponent
 $context
 
 $components
 
 $componentData = []
 
 $dataSources = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Prepares Color Picker UI component with mode and format

@api

Definition at line 21 of file ColorPicker.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ContextInterface  $context,
ColorModesProvider  $modesProvider,
array  $components = [],
array  $data = [] 
)

Constructor

Parameters
ContextInterface$context
ColorModesProvider$modesProvider
UiComponentFactory$uiComponentFactory
UiComponentInterface[]$components
array$data

Definition at line 43 of file ColorPicker.php.

48  {
49  $this->modesProvider = $modesProvider;
50  parent::__construct($context, $components, $data);
51  }

Member Function Documentation

◆ getComponentName()

getComponentName ( )

Get component name

Returns
string

Implements UiComponentInterface.

Definition at line 58 of file ColorPicker.php.

58  : string
59  {
60  return static::NAME;
61  }

◆ prepare()

prepare ( )

Prepare component configuration

Returns
void

Implements UiComponentInterface.

Definition at line 68 of file ColorPicker.php.

68  : 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  }

Field Documentation

◆ DEFAULT_MODE

const DEFAULT_MODE = 'full'

Definition at line 25 of file ColorPicker.php.

◆ NAME

const NAME = 'colorPicker'

Definition at line 23 of file ColorPicker.php.


The documentation for this class was generated from the following file: