private function TextFieldCounterWidgetTrait::translateValue in Textfield Counter 8
A unified translation function to translate values provided by this module.
Parameters
string $value: The key of the item to be translated.
Return value
string The translated value
2 calls to TextFieldCounterWidgetTrait::translateValue()
- TextFieldCounterWidgetTrait::addCounterPositionSettingsFormElement in src/
Plugin/ Field/ FieldWidget/ TextFieldCounterWidgetTrait.php - Adds a form element to set the position of the text counter.
- TextFieldCounterWidgetTrait::addPositionSummary in src/
Plugin/ Field/ FieldWidget/ TextFieldCounterWidgetTrait.php - Adds the summary of the position of the textfield counter.
File
- src/
Plugin/ Field/ FieldWidget/ TextFieldCounterWidgetTrait.php, line 403
Class
- TextFieldCounterWidgetTrait
- Textfield counter trait. Adds textfield counting functionality.
Namespace
Drupal\textfield_counter\Plugin\Field\FieldWidgetCode
private function translateValue($value) {
$values = [
'before' => $this
->t('Before'),
'after' => $this
->t('After'),
];
return $values[$value];
}