public function IngredientFormatter::settingsSummary in Recipe 8.2
Returns a short summary for the current formatter settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.
Return value
string[] A short summary of the formatter settings.
Overrides FormatterBase::settingsSummary
1 call to IngredientFormatter::settingsSummary()
- IngredientRecipeMLFormatter::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ IngredientRecipeMLFormatter.php - Returns a short summary for the current formatter settings.
1 method overrides IngredientFormatter::settingsSummary()
- IngredientRecipeMLFormatter::settingsSummary in src/
Plugin/ Field/ FieldFormatter/ IngredientRecipeMLFormatter.php - Returns a short summary for the current formatter settings.
File
- modules/
ingredient/ src/ Plugin/ Field/ FieldFormatter/ IngredientFormatter.php, line 142
Class
- IngredientFormatter
- Plugin implementation of the 'ingredient_default' formatter.
Namespace
Drupal\ingredient\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary[] = $this
->t('Fractions display string: @fraction_format', [
'@fraction_format' => $this
->getSetting('fraction_format'),
]);
$unit_display_options = $this
->getUnitDisplayOptions();
$unit_display_text = $unit_display_options[$this
->getSetting('unit_display')];
$summary[] = $this
->t('Ingredient unit display: @unit_display_text', [
'@unit_display_text' => $unit_display_text,
]);
$link_display_text = $this
->getSetting('link') ? $this
->t('Yes') : $this
->t('No');
$summary[] = $this
->t('Link to ingredient: @link_display_text', [
'@link_display_text' => $link_display_text,
]);
return $summary;
}