Comments

dbjpanda created an issue. See original summary.

dbjpanda’s picture

StatusFileSize
new794 bytes

Fixed.

krina.addweb’s picture

Status: Needs review » Reviewed & tested by the community

@dbjpanda,Thanks for the patch as i checked your patch manually by applying it in module file & it works well.

andypost’s picture

Status: Reviewed & tested by the community » Needs review
Related issues: +#2858062: $this->t() should be used instead of t() in Action classes

Looks like duplicate of #2858062: $this->t() should be used instead of t() in Action classes

If someone willing to fix that - it should be total cleanup

dbjpanda’s picture

@andypost the related issue which you have mentioned is of action module.Both the issue are for separate module. I could not get you what you want to convey.

andypost’s picture

I mean each issue needs proper title to point its scope (module name I guess)

phenaproxima’s picture

Title: t() calls should be avoided in classes » BatchTestMockForm should call $this->t(), not t()
Status: Needs review » Reviewed & tested by the community
Issue tags: +Coding standards

Patch looks good, re-titling for specificity.

manishmittal9’s picture

Status: Reviewed & tested by the community » Needs work

batch_test.callbacks is still affected

manishmittal9’s picture

New patch addressing #8

manishmittal9’s picture

Title: BatchTestMockForm should call $this->t(), not t() » t() should be replaced with $this->t() in batch_test module
Status: Needs work » Needs review
manishmittal9’s picture

Title: t() should be replaced with $this->t() in batch_test module » t() should be replaced with $this->t()
Status: Needs review » Needs work

As referenced in comment #15 on https://www.drupal.org/node/2858062, this issue is now open for a mega-patch to apply to all the Core API's

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

suman.abc’s picture

StatusFileSize
new1.04 KB

I have changed t() to $this->t() in file - core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php.
Please check the attached patch. It is working fine.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

nikitagupta’s picture

Assigned: Unassigned » nikitagupta
nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new26.81 KB

Status: Needs review » Needs work

The last submitted patch, 20: 2859390-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

nikitagupta’s picture

Status: Needs work » Needs review
StatusFileSize
new24.69 KB

Status: Needs review » Needs work

The last submitted patch, 22: 2859390-22.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

cburschka’s picture

- batch_test.callbacks.inc is procedural code; there is no $this.
- SystemInfoController does not use StringTranslationTrait, because it does not extend ControllerBase.

I'm sure there's a reason for not extending the base class (some other controllers in the namespace do, some others don't); I don't know if there's a reason not to use StringTranslationTrait directly.

cburschka’s picture

Status: Needs work » Needs review
StatusFileSize
new24.29 KB
new1.69 KB

Added StringTranslationTrait to SystemInfoController.

It looks like a reasonable change, but this may need some more review, because I don't understand the reason these controllers have for not extending ControllerBase.

Status: Needs review » Needs work

The last submitted patch, 25: 2859390-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

cburschka’s picture

Status: Needs work » Needs review
StatusFileSize
new24.75 KB
new1.56 KB

One of the forms (SystemBrandingOffCanvasForm) extends PluginFormBase, which also does not extend FormBase or use StringTranslationTrait. This caused the test failures (which look a bit arcane because this is an AJAX form and only covered by Javascript tests).

(Also fixing a whitespace error that snuck into the patch.)

Note regarding test coverage: The earlier errors in SystemInfoController and batch_test.callbacks.inc didn't apparently cause any test failures.

nikitagupta’s picture

Assigned: nikitagupta » Unassigned
tanubansal’s picture

StatusFileSize
new309.79 KB

Tested #27, changes are visible in the code

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vikashsoni’s picture

Patch applied successfully t() replaced with $this->t()
Thanks for the patch

quietone’s picture

Thanks everyone for contributing to the improvement of Drupal.

It turns out that the fixes here were done in #3122912: t() calls should be avoided , use $this->t() instead in Form Builders. Although that is a later issue I am closing this as a duplicate and adding a parent issue.

quietone’s picture