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.
t()
calls should be avoided in classes, use DI and $this->t()
instead:
DrupalPractice has found some issues with your code, but could be false positives.
FILE: ...eview_temp/src/Plugin/Field/FieldWidget/AutocompleteDeluxeWidget.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------
347 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
348 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
--------------------------------------------------------------------------
Comment | File | Size | Author |
---|---|---|---|
#11 | 3071352-11.patch | 1.39 KB | Sergei Churilo |
#6 | 3071352-6.patch | 2.4 KB | vuil |
#2 | 3071352-2.patch | 2.4 KB | vuil |
Comments
Comment #2
vuilComment #3
vuilComment #4
vuilAny update and/or review? Thanks.
Comment #5
edwardchiapetThanks, @vuil!
In the following changes, should
self::t(...)
be updated to$this->t(...)
instead?Comment #6
vuilUpdated! Thank you.
Comment #7
edwardchiapetThank you, @vuil!
The updated patch looks great!
Will merge into 8.x-1.x-dev.
Comment #9
edwardchiapetComment #11
Sergei Churilo CreditAttribution: Sergei Churilo commentedIt is not allowed to call $this when in object context.
Comment #12
edwardchiapetComment #13
edwardchiapetThanks, @Jabb - for catching that!
The patch looks good and I will merge into 8.x-1.x-dev.
Comment #15
edwardchiapet