public function Dimension::settingsSummary in Dimension 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldWidget/Dimension.php \Drupal\dimension\Plugin\Field\FieldWidget\Dimension::settingsSummary()
- 2.1.x src/Plugin/Field/FieldWidget/Dimension.php \Drupal\dimension\Plugin\Field\FieldWidget\Dimension::settingsSummary()
Returns a short summary for the current widget settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.
Return value
array A short summary of the widget settings.
Overrides NumberWidget::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ Dimension.php, line 68
Class
Namespace
Drupal\dimension\Plugin\Field\FieldWidgetCode
public function settingsSummary() : array {
$summary = [];
/** @noinspection StaticInvocationViaThisInspection */
foreach ($this
->fields() as $key => $label) {
$settings = $this
->getSetting($key);
$placeholder = $settings['placeholder'];
if (!empty($placeholder)) {
$summary[] = $this
->t('@label: @placeholder', [
'@label' => $settings['label'],
'@placeholder' => $placeholder,
]);
}
else {
$summary[] = $this
->t('@label: No placeholder', [
'@label' => $settings['label'],
]);
}
}
return $summary;
}