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 |
---|---|---|---|
#13 | modernize_path_module-2077999-13.patch | 586 bytes | kostyashupenko |
#7 | modernize_path_module-2077999-7.patch | 1002 bytes | nielsonm |
Comments
Comment #1
plopescHello
t()
replaced and improved doc using{@inheritdoc}
.Regards.
Comment #4
er.pushpinderrana CreditAttribution: er.pushpinderrana commentedUnable to apply above patch. Please review updated patch.
Comment #5
dawehnerTry to add the t() => ->t() changes as well.
Comment #6
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@dawehner, thanks for your feedback. Please review attached patch.
Comment #7
nielsonm CreditAttribution: nielsonm at Phase2 commentedRerolled.
Comment #8
xjmComment #9
daffie CreditAttribution: daffie commentedAlso not all instances of
t()
are changed to$this->t()
Comment #10
j2r CreditAttribution: j2r commentedComment #11
j2r CreditAttribution: j2r commentedComment #12
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 #13
kostyashupenkoRerolled
Comment #15
ricardoamaro CreditAttribution: ricardoamaro as a volunteer and at Acquia commentedI tested this at DrupalCon, it still works!
Can we get some traction here, please?
:)
Comment #28
quietone CreditAttribution: quietone at PreviousNext commentedThanks for working on this. The form being changed was deleted in #3007832: Convert custom path alias forms to entity forms.
I am closing this as outdated.