Part of #2072251: [meta] Modernize forms to use FormBase

Updated: Comment #N


Now that #2059245: Add a FormBase class containing useful methods is in, I was looking at old forms that have empty validateForm() methods, or still use Drupal::service() or t().

Proposed resolution

Convert existing FormInterface forms to extend FormBase

Remaining tasks

User interface changes

API changes

#5 editor_forms-2077973-5.patch2.13 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 58,958 pass(es).
[ View ]
#3 editor_forms-2077973-3.patch5.76 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 58,401 pass(es).
[ View ]
#3 interdiff.txt485 bytesplopesc
#1 editor_forms-2077973-1.patch5.76 KBplopesc
PASSED: [[SimpleTest]]: [MySQL] 58,489 pass(es).
[ View ]


Status:Active» Needs review
new5.76 KB
PASSED: [[SimpleTest]]: [MySQL] 58,489 pass(es).
[ View ]


With this patch, editor module forms inherits from FormBase and removed usages of t(), replaced by $this->t().


Status:Needs review» Needs work

Just one minor nitpick:

+++ b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php
@@ -7,19 +7,18 @@

Extraneous newline.

Status:Needs work» Needs review
new485 bytes
new5.76 KB
PASSED: [[SimpleTest]]: [MySQL] 58,401 pass(es).
[ View ]

Removing empty line...

Status:Needs review» Postponed

Looks good to go, but this will conflict with #2027181: Use a CKEditor Widget to create a stellar UX for captioning and aligning images, which also fixes this for EditorImageDialog, which has been dragging along for months. I want to avoid yet another reroll.

So: postponing this issue on that issue. Sorry.

Status:Postponed» Needs review
new2.13 KB
PASSED: [[SimpleTest]]: [MySQL] 58,958 pass(es).
[ View ]

Status:Needs review» Reviewed & tested by the community

Code looks good. Makes EditorLinkDialog's code look like EditorImageDialog's (see #4).

Manually tested, all continues to work well.


Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.