public function AddtocalView::settingsSummary in Add to Cal 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldFormatter/AddtocalView.php \Drupal\addtocal\Plugin\Field\FieldFormatter\AddtocalView::settingsSummary()
Return value
string[] A short summary of the formatter settings.
Overrides DateTimeCustomFormatter::settingsSummary
File
- src/
Plugin/ Field/ FieldFormatter/ AddtocalView.php, line 47
Class
- AddtocalView
- Plugin annotation @FieldFormatter( id = "addtocal_view", label = @Translation("Add to Cal"), field_types = { "date", "datestamp", "datetime", "daterange", } )
Namespace
Drupal\addtocal\Plugin\Field\FieldFormatterCode
public function settingsSummary() {
$summary = parent::settingsSummary();
$settings = $this
->getSettings();
$location = $settings['location']['value'] ? $settings['location']['value'] : $this
->t("Static Text");
$description = $settings['description']['value'] ? $settings['description']['value'] : $this
->t("Static Text");
$summary[] = $this
->t('Location field: %location', [
'%location' => $location,
]);
$summary[] = $this
->t('Description field: %description', [
'%description' => $description,
]);
// Date Range field type settings
$field = $this->fieldDefinition;
if ($field
->getType() == 'daterange') {
if ($separator = $this
->getSetting('separator')) {
$summary[] = $this
->t('Separator: %separator', [
'%separator' => $separator,
]);
}
}
return $summary;
}