Same name and namespace in other branches
  1. 3.0.x src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php \Drupal\color_field\Plugin\Field\FieldFormatter\ColorFieldFormatterSwatchOptions::viewRawValue()

Return the raw field value.

Paramètres

\Drupal\color_field\Plugin\Field\FieldType\ColorFieldType $item: The color field item.

Return value

string The color hex value.

1 call to ColorFieldFormatterSwatchOptions::viewRawValue()
ColorFieldFormatterSwatchOptions::viewElements dans src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php

Fichier

src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php, line 70

Classe

ColorFieldFormatterSwatchOptions
Plugin implementation of the color_field swatch formatter.

Namespace

Drupal\color_field\Plugin\Field\FieldFormatter

Code

protected function viewRawValue(ColorFieldType $item) {
    return (new ColorHex($item->color, $item->opacity))
        ->toString(FALSE);
}