Problem/Motivation
When I try to use the imagepins TextWidget on a media image, I just get an ajax error.
In the recent log messages I can see that the t() method is not defined.
Error: Call to undefined method Drupal\imagepin\Plugin\imagepin\Widget\TextWidget::t() in Drupal\imagepin\Plugin\imagepin\Widget\TextWidget->formNewElement() (line 28 of drupal/web/modules/contrib/imagepin/src/Plugin/imagepin/Widget/TextWidget.php)
Steps to reproduce
Press the "Pin widgets on this image" button under an image (my image is translatable).
This will just lead to an ajax error instead of opening the modal to create pins.
Proposed resolution
Use the StringTranslationTrait in WidgetBase to make the t() method available for all widgets.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | imagepin-missing-t-method-3214333-0.patch | 498 bytes | guido_s |
Comments
Comment #2
guido_sI added the StringTranslationTrait in WidgetBase.php so that the t() method is available for all widgets and doesn't lead to ajax errors anymore.
Comment #3
guido_sComment #4
phjouI got the same issue, the patch works great, thanks.
Comment #6
mxh commentedCommitted, thanks!