Problem/Motivation
ConfirmFormInterface::getDescription()
is designed to return only translated strings. However, sometime the description gets complex, involving a lot of markup that fits better to a renderable array than a simple string.
Proposed resolution
Alternatively, allow renderable arrays as return for ConfirmFormInterface::getDescription()
.
Remaining tasks
None.
User interface changes
None.
API changes
Before:
/**
* Returns additional text to display as a description.
*
* @return string
* The form description.
*/
public function getDescription();
After:
/**
* Returns additional text to display as a description.
*
* The text can be provided as a translated string or as a renderable array.
*
* @return string|array
* The form description.
*/
public function getDescription();
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#25 | interdiff_24-25.txt | 511 bytes | Nikhil_110 |
#25 | 2575375-25.patch | 3.53 KB | Nikhil_110 |
| |||
#24 | 2575375-24.patch | 3.54 KB | Nikhil_110 |
#23 | 2575375-nr-bot.txt | 144 bytes | needs-review-queue-bot |
#18 | reroll_diff_6-18.txt | 4.81 KB | raman.b |
Comments
Comment #2
claudiu.cristeaPatch.
Comment #3
Wim LeersSeems to make sense :)
Claudiu told me this is necessary over at #2479487: ImageStyles can be deleted while having dependent configuration..
Comment #4
tim.plunkettWe have \Drupal\system\Tests\Form\ConfirmFormTest, let's expand it to test this.
Comment #5
claudiu.cristeaComment #6
claudiu.cristeaComment #7
XanoIf a method suddenly returns a new data type, it breaks calling code that does not expect this new type. Because this is an API method (and not an internal one), this is a backwards-compatibility breaking API change.
Comment #18
raman.b CreditAttribution: raman.b at OpenSense Labs commentedRe-rolled #6 for the current dev branch
Comment #23
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #24
Nikhil_110 CreditAttribution: Nikhil_110 at Srijan | A Material+ Company commentedAttached patch against Drupal 10.1.x
Patch #18 is not applied for Drupal 10.1.x so Inter-diff file is not added.
Comment #25
Nikhil_110 CreditAttribution: Nikhil_110 at Srijan | A Material+ Company commentedFixed CC issue #24
Comment #26
Nikhil_110 CreditAttribution: Nikhil_110 at Srijan | A Material+ Company commentedComment #27
smustgrave CreditAttribution: smustgrave at Mobomo commentedThink new function will need a change record.
Tests shouldn't use t() if not testing translations
New function should be typehinted.