You are here

protected function CustomFormatters::getLabel in Custom Formatters 8.3

Returns Formatter label with optional prefix.

Parameters

string $label: Formatter label.

Return value

string The Formatter label with optional prefix.

1 call to CustomFormatters::getLabel()
CustomFormatters::getDerivativeDefinitions in src/Plugin/Derivative/CustomFormatters.php
Gets the definition of all derivatives of a base plugin.

File

src/Plugin/Derivative/CustomFormatters.php, line 52

Class

CustomFormatters
Retrieves field formatter plugin definitions for all custom formatters.

Namespace

Drupal\custom_formatters\Plugin\Derivative

Code

protected function getLabel($label) {

  // Label prefix.
  if ($this->settings
    ->get('label_prefix')) {
    $label = "{$this->settings->get('label_prefix_value')}: {$label}";
  }
  return $label;
}