Same name and namespace in other branches
  1. 8.x-2.x src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php \Drupal\color_field\Plugin\Field\FieldFormatter\ColorFieldFormatterText::getColorFormat() 1 comment

This function is used to get the color format.

Parameters

string|null $format: Format is of string type.

Return value

\Drupal\Component\Render\MarkupInterface[]|\Drupal\Component\Render\MarkupInterface Returns array or string.

2 calls to ColorFieldFormatterText::getColorFormat()
ColorFieldFormatterText::settingsForm in src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
ColorFieldFormatterText::settingsSummary in src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php

File

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

Class

ColorFieldFormatterText
Plugin implementation of the color_field text formatter.

Namespace

Drupal\color_field\Plugin\Field\FieldFormatter

Code

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