Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of #2072251: [meta] Modernize forms to use FormBase
Updated: Comment #N
Problem/Motivation
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
Related Issues
Comment | File | Size | Author |
---|---|---|---|
#7 | modernize_menu_module-2077989-7.patch | 2.12 KB | nielsonm |
Comments
Comment #1
plopescFirst round...
Comment #4
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedUnable to apply above patch. Please review updated patch.
Comment #5
dawehnerThis is also looking nice, thought this will conflict with #2301239: MenuLinkNG part1 (no UI or conversions): plugins (static + MenuLinkContent) + MenuLinkManager + MenuTreeStorage or some of its sibling issues.
Comment #6
amitgoyal CreditAttribution: amitgoyal commentedPlease review revised patch with 2 minor fixes in MenuSettingsForm.php.
Comment #7
nielsonm CreditAttribution: nielsonm at Phase2 commentedRerolled.
Comment #8
xjmComment #9
daffie CreditAttribution: daffie commentedThe patch still applies on my local machine. All instances of
t()
are changed to$this->t()
. So for me it is RTBC.Comment #10
alexpottDiscussed this issue with @xjm. Looking at the title of the issue I expected far more modernisation - it looks like much of the work was done in other issue - I guess this is due to this issue being 3 years old. Given that the scope of the current patch is changing t() to $this->t() I think we need to adjust this issue's scope and look for other related and duplicate issues - @xjm says that there is probably a deprecate t() issue. All t() usage is non-static methods in classes is suspect and should be removed. We need get a rule added to coder to find this and come up with a plan how to do all the work sensibly in core. For more on scope issues see https://www.drupal.org/core/scope for guidelines and examples. Doing this work piecemeal will mean it'll never get done and there's a high chance we'll introduce regressions.
Comment #24
quietone CreditAttribution: quietone at PreviousNext commentedThis was fixed as part of #3122912: t() calls should be avoided , use $this->t() instead in Form Builders.
I am closing this as outdated.