public function DropdownFieldFormatter::getLabelForValue in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.2 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.3 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.4 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.5 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.7 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 8.8 modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 10.3.x modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 10.0.x modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 10.1.x modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
- 10.2.x modules/custom/dropdown/src/Plugin/Field/FieldFormatter/DropdownFieldFormatter.php \Drupal\dropdown\Plugin\Field\FieldFormatter\DropdownFieldFormatter::getLabelForValue()
Display dropdown labels.
1 call to DropdownFieldFormatter::getLabelForValue()
- DropdownFieldFormatter::viewValue in modules/
custom/ dropdown/ src/ Plugin/ Field/ FieldFormatter/ DropdownFieldFormatter.php - Generate the output appropriate for one field item.
File
- modules/
custom/ dropdown/ src/ Plugin/ Field/ FieldFormatter/ DropdownFieldFormatter.php, line 54
Class
- DropdownFieldFormatter
- Plugin implementation of the 'dropdown_field_formatter' formatter.
Namespace
Drupal\dropdown\Plugin\Field\FieldFormatterCode
public function getLabelForValue($value) {
$settings = $this
->getFieldSettings();
$allowed_values = $settings['allowed_values'];
foreach ($allowed_values as $allowed_value) {
if (isset($allowed_value['value']) && $allowed_value['value'] === $value) {
$label = $allowed_value['label'];
return Html::escape($label);
}
}
}