Skip to content
Snippets Groups Projects
Commit 731969da authored by Pierre Dureau's avatar Pierre Dureau
Browse files

Issue #3519282 by pdureau, christian.wiedemann: Add PluginSettingsInterface::settingsSummary()

parent eb8ea0b4
Branches
Tags
1 merge request!373Issue #3519282 by pdureau: Add PluginSettingsInterface::settingsSummary()
Pipeline #501018 passed
......@@ -35,6 +35,16 @@ class EntityFieldSource extends DerivableContextSourceBase {
return $form;
}
/**
* {@inheritdoc}
*/
public function settingsSummary(): array {
$derivable_context = explode(':', $this->getSetting("derivable_context") ?? '');
return [
$derivable_context[array_key_last($derivable_context)],
];
}
/**
* {@inheritDoc}
*/
......
......@@ -130,6 +130,15 @@ class EntityLinksSource extends SourcePluginBase {
return $form;
}
/**
* {@inheritdoc}
*/
public function settingsSummary(): array {
return [
$this->getSetting('template') ?? '',
];
}
/**
* Get menus list.
*
......
......@@ -142,6 +142,15 @@ class TokenSource extends SourcePluginBase {
return $form;
}
/**
* {@inheritdoc}
*/
public function settingsSummary(): array {
return [
$this->getSetting('value'),
];
}
/**
* {@inheritdoc}
*/
......
......@@ -107,6 +107,16 @@ class WysiwygWidget extends SourcePluginBase implements TrustedCallbackInterface
return $form;
}
/**
* {@inheritdoc}
*/
public function settingsSummary(): array {
$value = $this->getSetting('value')['value'] ?? '';
return [
substr(strip_tags($value), 0, 20),
];
}
/**
* {@inheritdoc}
*/
......
......@@ -54,4 +54,12 @@ interface PluginSettingsInterface {
*/
public function settingsForm(array $form, FormStateInterface $form_state): array;
/**
* Returns a short summary for the current settings.
*
* @return array<string|\Stringable>
* A short summary of the settings.
*/
public function settingsSummary(): array;
}
......@@ -179,6 +179,13 @@ abstract class SourcePluginBase extends PluginBase implements
return $this;
}
/**
* {@inheritdoc}
*/
public function settingsSummary(): array {
return [];
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment