You are here

protected function ColorFieldFormatterText::getColorFormat in Color Field 8.2

This function is used to get the color format.

Parameters

string $format: Format is of string type.

Return value

array|string Returns array or string.

2 calls to ColorFieldFormatterText::getColorFormat()
ColorFieldFormatterText::settingsForm in src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
Returns a form to configure settings for the formatter.
ColorFieldFormatterText::settingsSummary in src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
Returns a short summary for the current formatter settings.

File

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

Class

ColorFieldFormatterText
Plugin implementation of the color_field text formatter.

Namespace

Drupal\color_field\Plugin\Field\FieldFormatter

Code

protected function getColorFormat($format = NULL) {
  $formats = [];
  $formats['hex'] = $this
    ->t('Hex triplet');
  $formats['rgb'] = $this
    ->t('RGB Decimal');
  if ($format) {
    return $formats[$format];
  }
  return $formats;
}