Commit 358699f3 authored by NickWilde's avatar NickWilde

Issue #2890042 by chrissnyder, NickWilde: Token support for Color CSS declaration

parent 454afc6c
.color_field {
}
.color_field__swatch {
}
.color_field__swatch--square {
}
.color_field__swatch--circle {
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
......
......@@ -90,8 +90,6 @@ class ColorFieldFormatterCss extends FormatterBase implements ContainerFactoryPl
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
$opacity = $this->getFieldSetting('opacity');
$elements = [];
$elements['selector'] = array(
......@@ -103,14 +101,12 @@ class ColorFieldFormatterCss extends FormatterBase implements ContainerFactoryPl
'#required' => TRUE,
'#placeholder' => 'body > div > a',
);
// $element['token'] = array(
// '#theme' => 'token_tree',
// '#token_types' => array($instance['entity_type']),
// '#dialog' => TRUE,
// ); .
$elements['token_help'] = array(
'#theme' => 'token_tree_link',
'#token_types' => array($this->fieldDefinition->getTargetEntityTypeId()),
);
$elements['property'] = array(
'#title' => $this->t('Property'),
'#description' => '',
'#type' => 'select',
'#default_value' => $this->getSetting('property'),
'#required' => TRUE,
......@@ -126,7 +122,7 @@ class ColorFieldFormatterCss extends FormatterBase implements ContainerFactoryPl
'#default_value' => $this->getSetting('important'),
);
if ($opacity) {
if ($this->getFieldSetting('opacity')) {
$elements['opacity'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Display opacity'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment