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.
Problem/Motivation
As discovered in #2886517: [regression] Flag text fields do not support HTML The Fla.g views link field plugin doesn't use flag.html.twig like it's supposed to. In fact, it uses a far older rendering method.
Proposed resolution
Update the views link field plugin to use ActionLinkTypeBase::getAsFlagLink() or a similar method that will be more maintainable.
Remaining tasks
Create patch.
User interface changes
None.
API changes
Views link field would use the template like it's supposed to.
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | 2888268-8-views-link-doesnt-use-twig.patch | 1.17 KB | andileco |
|
Comments
Comment #2
socketwench CreditAttribution: socketwench at TEN7 commentedComment #3
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedThe following was helpful for me:
Comment #4
maaty388 CreditAttribution: maaty388 commentedComment #5
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedWhy was this marked "Works as designed"?
Comment #6
maaty388 CreditAttribution: maaty388 commentedThis custom code works
Comment #7
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedThanks! I changed back to needs work, so that I can create a patch. Then we would move to "Needs Review" or "Ready to be committed" when that's posted.
Comment #8
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedPatch attached.
Comment #10
martin107 CreditAttribution: martin107 as a volunteer commentedWe have a branch blocker at the moment ....
I am a bit busy at the moment .. I am trying to clear it as part of #2898502: Convert/Modernise FlagContextualLinksTest
sorry time is pressing for me at the moment...perhaps we need to open an isolated branch blocker issue.
Comment #11
jantoine CreditAttribution: jantoine as a volunteer commentedWith the branch blocker issue now resolved, should the status of this issue be updated?
Comment #12
martin107 CreditAttribution: martin107 as a volunteer commentedThanks for the prompt ... patch still applies - Moving to needs review to trigger testbot ... which fingers crossed should be green.
Comment #14
socketwench CreditAttribution: socketwench at TEN7 commentedYep, still passes!
Thanks everyone!
Comment #15
pradeepjha CreditAttribution: pradeepjha commentedAfter applying above patch. I was able to use follow link in ajaxified way but got following error.
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\flag\Plugin\views\field\FlagViewsLinkField::renderLink() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /home/**/**/html/modules/contrib/flag/src/Plugin/views/field/FlagViewsLinkField.php on line 76 in Drupal\flag\Plugin\views\field\FlagViewsLinkField->renderLink() (line 114 of modules/contrib/flag/src/Plugin/views/field/FlagViewsLinkField.php).
Comment #16
socketwench CreditAttribution: socketwench at TEN7 commented@pradeepjha I created a follow up issue here: #2917836: Null passed to AJAXified FlagViewsLinkField::renderLink()