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
In Drupal 8, hook_views_data() was moved to a new object, EntityViewsHandlerInterface: https://www.drupal.org/node/2320249
Proposed resolution
To conform to the new API Flag 8.x's view support will need to be rewritten.
Remaining tasks
- Complete patch
- Write tests
User interface changes
None.
API changes
Changes to the views handler class names.
Comments
Comment #1
socketwench CreditAttribution: socketwench commentedComment #3
jibranSo should I add patches here?
Comment #4
socketwench CreditAttribution: socketwench commented@jibran: Yes please. We're in the process of phasing out the github repo.
Comment #5
jibranThis is related here #2378729: JoinPluginBase doesn't allow extra conditions on left table. It will allow to create a relationship between flagged to entity type data table.
Something like this.
After adding the relationship it results in
Above issue allows us to add
AND flagging.entity_type = 'node'
condition to join.Comment #6
BerdirInstead of unsetting it here, you should remove it from the annotation. It only makes sense to have it when Translatable there is set to true.
Comment #7
jibranOh I kind a forgot this issue. Now that #2321721: Provide a views relationship for each dynamic entity reference field is RTBC I have time and I think I can move forward here as join issue is also in, views data using data tables now and views is using fields plugin for views fields. I'll try to have a look at it during this weekend.
Comment #8
joachim CreditAttribution: joachim commentedComment #9
joachim CreditAttribution: joachim commentedOops.
Comment #10
joachim CreditAttribution: joachim commentedI think we should reduce the focus of this issue to providing a views_data handler for flaggings that subclasses from EntityViewsData. We can rename all the handler classes as a follow-up.
I'm in the process of looking at our views support now that our flagging field names are fixed, and I've filed a number of bugs both here and in core.
Some things to take into account:
- we should omit the delete link field
- until #2491875: EntityViewsData adds Operations links to all entities, which won't work if the entity type has no list builder, leading to WSOD on some views is fixed, we have to omit the entity operations field
Comment #11
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedRerolled the patch with the renamings.
Comment #12
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedAdded the rendering_language in the default config, to get rid of the for the SQL errors.
Next up: tests.
Comment #13
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedAdded the test and the default config for the view.
Comment #14
joachim CreditAttribution: joachim commentedThanks for working on this.
It does still need scaling back as detailed in #10: filename changes and plugin name changes should be left for future issues. This should be just about making use of a views_data handler.
Tests are a good idea, but I'm not sure what they are covering.
This is covered by other tests -- we don't need to go via the admin UI to create our flag here, just create it programatically. Or for that matter, your test module seems to contain a flag in config code.
I'm not sure what this is testing! Can a comment be added please?
This seems to be copied from another test? I don't know why we're testing flagging a node all over again here.
Comment #15
joachim CreditAttribution: joachim commentedBTW, I don't understand what this bit does:
Comment #16
joachim CreditAttribution: joachim commentedWork in progress, rushed for time... not had a chance to look at the tests.
Also, the relationship from entity to flagging seems to be broken, so maybe this issue should be postponed on fixing that.
Comment #17
socketwench CreditAttribution: socketwench commentedComment #19
socketwench CreditAttribution: socketwench commentedPatch no longer applies, also this may be even further out of date given other views issues.
Comment #20
joachim CreditAttribution: joachim commentedThis is the problem. It's crept into this patch, despite being part of another issue which has now been committed -- hence why this patch is not applying.
Comment #21
joachim CreditAttribution: joachim commentedRebased my branch and rerolled.
Comment #23
joachim CreditAttribution: joachim commentedOops.
Comment #24
BerdirThis looks fine. We're just refactoring code, so I don't think we need the needs tests tag anymore.
Comment #25
joachim CreditAttribution: joachim commentedThanks for the review!
Committed.