From aa925f6d94a37db149eea9fc1485d67a6926a535 Mon Sep 17 00:00:00 2001 From: Rias Date: Thu, 1 Oct 2026 10:10:36 +0200 Subject: [PATCH 1/2] Add suffix support to text form controls Co-authored-by: Nathaniel Hammond --- CHANGELOG.md | 1 + resources/js/modules/forms/TextControl.vue | 6 +++++- resources/js/modules/forms/types.ts | 1 + src/Form/Controls/Text.php | 11 +++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3adee70813c..f2ef1bb91cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,7 @@ - Removed `CraftCms\Cms\Plugin\Concerns\HasFilesystemTypes`. Plugins can no longer register custom Craft filesystem types. ([#19650](https://github.com/craftcms/cms/pull/19650)) ### Plugins & Extensibility +- Added `CraftCms\Cms\Form\Controls\Text::suffix()` for display-only suffix text in PHP and Vue form controls. ([#19665](https://github.com/craftcms/cms/pull/19665)) - Added `CraftCms\Cms\Element\Data\ElementSiteSettings`, the shared base for element URI and route settings. ([#19762](https://github.com/craftcms/cms/pull/19762)) - Added support for fluent plugin settings classes. ([#19574](https://github.com/craftcms/cms/pull/19574)) - Added support for refreshable standard plugin settings forms and conditional configuration of core form nodes. ([#19545](https://github.com/craftcms/cms/pull/19545)) diff --git a/resources/js/modules/forms/TextControl.vue b/resources/js/modules/forms/TextControl.vue index 37f0f8d5b8f..f3764d08f2d 100644 --- a/resources/js/modules/forms/TextControl.vue +++ b/resources/js/modules/forms/TextControl.vue @@ -80,7 +80,11 @@ @model-value-changed="onModelValueChanged" > - + + {{ + control.props.suffix + }} + inputSize($control->props['size'] ?? null) ->orientation($control->props['dir'] ?? null) ->monospace((bool) ($control->props['monospace'] ?? false)) + ->suffix($control->props['suffix'] ?? null) ->disabled($attributes['disabled'] || ($attributes['readonly'] && ($control->props['inputType'] ?? 'text') === 'range')) ->readOnly($attributes['readonly']) ->describedBy($attributes['aria']['describedby'] ?? null) @@ -178,6 +181,13 @@ public function monospace(bool $monospace = true): static return $this; } + public function suffix(?string $suffix): static + { + $this->suffix = $suffix; + + return $this; + } + #[\Override] public function props(mixed $value = null): array { @@ -196,6 +206,7 @@ public function props(mixed $value = null): array 'size' => $this->size, 'dir' => $this->dir, 'monospace' => $this->monospace ?: null, + 'suffix' => $this->suffix, ...$this->textExpanderProps(), ]); } From 74874d96c381b3ac86a9d8f045ac7b037d33f5b4 Mon Sep 17 00:00:00 2001 From: Rias Date: Thu, 1 Oct 2026 10:10:49 +0200 Subject: [PATCH 2/2] Reference the text suffix extraction PR in the changelog Co-authored-by: Nathaniel Hammond --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ef1bb91cc..521025d228a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,7 +154,7 @@ - Removed `CraftCms\Cms\Plugin\Concerns\HasFilesystemTypes`. Plugins can no longer register custom Craft filesystem types. ([#19650](https://github.com/craftcms/cms/pull/19650)) ### Plugins & Extensibility -- Added `CraftCms\Cms\Form\Controls\Text::suffix()` for display-only suffix text in PHP and Vue form controls. ([#19665](https://github.com/craftcms/cms/pull/19665)) +- Added `CraftCms\Cms\Form\Controls\Text::suffix()` for display-only suffix text in PHP and Vue form controls. ([#19770](https://github.com/craftcms/cms/pull/19770)) - Added `CraftCms\Cms\Element\Data\ElementSiteSettings`, the shared base for element URI and route settings. ([#19762](https://github.com/craftcms/cms/pull/19762)) - Added support for fluent plugin settings classes. ([#19574](https://github.com/craftcms/cms/pull/19574)) - Added support for refreshable standard plugin settings forms and conditional configuration of core form nodes. ([#19545](https://github.com/craftcms/cms/pull/19545))