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.
We have a Flag type plugin for nodes which adds two things:
- extra options for allowing flagging based on node authorship
- extra options for flagging with translations of nodes
Both of these things are now generic in D8:
- any entity can implement authorship with EntityOwnerInterface
- entities are generally translatable
How can we handle this?
Comments
Comment #1
joachim CreditAttribution: joachim commentedTranslation of entities now works at the field level. So whereas on D7 and previous, you'd have a 'translation set' formed of several different nodes, each one in a different language, on D8, the single node with just one ID has multiple language versions. So translation support for nodes isn't something we need to worry about any more: there is no more need to sync flaggings between translations. On the other hand, flagging only one translation of a node is no longer possible.
Then there's behaviour around the entity author. I think we should move this out of the node flag type plugin. Still pondering how.
Comment #2
socketwench CreditAttribution: socketwench as a volunteer commentedMy first thought is to move the features you identified to the Entity flag type. Beyond that, not sure.
Comment #3
joachim CreditAttribution: joachim commentedYeah, that's the simplest way to do it.
We can detect whether an entity type has 'authorship' by whether it has a 'uid' in its entity_keys property (except for Comment... possibly a core bug, need to file).
I was getting ideas of having a 2nd plugin system for 'entity behaviours', and bringing plugins in automatically according to criteria -- somewhat like conditional traits. Which given we only have one such behaviour is probably a huge overkill :)
Comment #4
socketwench CreditAttribution: socketwench as a volunteer commentedSplitting this off into two smaller issues.