public function JsonEditorWidget::settingsSummary in JSON Field 8
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 WidgetBase::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ JsonEditorWidget.php, line 103
Class
- JsonEditorWidget
- Plugin implementation of the 'json_editor' widget.
Namespace
Drupal\json_field\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = [];
$summary[] = t('Mode: @mode', [
'@mode' => $this
->getSetting('mode'),
]);
$summary[] = t('Available modes: @modes', [
'@modes' => implode(', ', $this
->getEditorModes()),
]);
$has_schema = !empty($this
->getSetting('schema'));
$summary[] = t('JSON schema: @exists', [
'@exists' => $has_schema ? t('Yes') : t('No'),
]);
if ($has_schema) {
$summary[] = t('JSON schema validation: @validate', [
'@validate' => $this
->getSetting('schema_validate') ? t('Yes') : t('No'),
]);
}
return $summary;
}