diff --git a/src/Plugin/UiPatterns/Source/EntityFieldSource.php b/src/Plugin/UiPatterns/Source/EntityFieldSource.php index b4fa5f04ec60ddd633cdeb79de6c3ec6e7e0822c..f7f6d1ec96d95760ce3bdbb316a72a3d366b9fc8 100644 --- a/src/Plugin/UiPatterns/Source/EntityFieldSource.php +++ b/src/Plugin/UiPatterns/Source/EntityFieldSource.php @@ -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} */ diff --git a/src/Plugin/UiPatterns/Source/EntityLinksSource.php b/src/Plugin/UiPatterns/Source/EntityLinksSource.php index c28dffeab70a6a576e5c52fb204ee45fcb39e4d8..3cceaf250b2c2a17e922e5955f44e38507e62bb3 100644 --- a/src/Plugin/UiPatterns/Source/EntityLinksSource.php +++ b/src/Plugin/UiPatterns/Source/EntityLinksSource.php @@ -130,6 +130,15 @@ class EntityLinksSource extends SourcePluginBase { return $form; } + /** + * {@inheritdoc} + */ + public function settingsSummary(): array { + return [ + $this->getSetting('template') ?? '', + ]; + } + /** * Get menus list. * diff --git a/src/Plugin/UiPatterns/Source/TokenSource.php b/src/Plugin/UiPatterns/Source/TokenSource.php index f7227c616973ce13c524ba9af7134f80b6392233..0275bc96ce45beeeecf84b5c9f78b4fcf385e895 100644 --- a/src/Plugin/UiPatterns/Source/TokenSource.php +++ b/src/Plugin/UiPatterns/Source/TokenSource.php @@ -142,6 +142,15 @@ class TokenSource extends SourcePluginBase { return $form; } + /** + * {@inheritdoc} + */ + public function settingsSummary(): array { + return [ + $this->getSetting('value'), + ]; + } + /** * {@inheritdoc} */ diff --git a/src/Plugin/UiPatterns/Source/WysiwygWidget.php b/src/Plugin/UiPatterns/Source/WysiwygWidget.php index c8ae1a89781356cdfe8c10ce9c7fc7f0c4b27bbd..e6f24d5261e182e101ca1a1e1efbad4503406ca4 100644 --- a/src/Plugin/UiPatterns/Source/WysiwygWidget.php +++ b/src/Plugin/UiPatterns/Source/WysiwygWidget.php @@ -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} */ diff --git a/src/PluginSettingsInterface.php b/src/PluginSettingsInterface.php index cbae576ef4181b6327b65a82570043ab7e6e9bc5..beb427346b5a5ee6fba046fbb975245d98bd7780 100644 --- a/src/PluginSettingsInterface.php +++ b/src/PluginSettingsInterface.php @@ -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; + } diff --git a/src/SourcePluginBase.php b/src/SourcePluginBase.php index 9876b8577536d3efe6e77d2a667e4d96d2c60c32..1cdde8d31a160a02913c628282897308776ca47b 100644 --- a/src/SourcePluginBase.php +++ b/src/SourcePluginBase.php @@ -179,6 +179,13 @@ abstract class SourcePluginBase extends PluginBase implements return $this; } + /** + * {@inheritdoc} + */ + public function settingsSummary(): array { + return []; + } + /** * {@inheritdoc} */