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.
The "Node links" (ie. "Read more", "Add new comment", etc) are normally provided via NodeViewBuilder
. However, if we override the node view with Page Manager or Panelizer, we'll need a block to show them!
This issue is to create such a block.
We should look at the CTools "content type" we had in D7 (ctools/plugins/content_types/node_context/node_links.inc) and make sure we support all the same configuration and features (assuming they make sense in D8).
Comment | File | Size | Author |
---|---|---|---|
#12 | interdiff-9-12.txt | 658 bytes | thalles |
#12 | 2664654-12.patch | 3.09 KB | thalles |
#9 | interdiff-2664654-4-9.txt | 659 bytes | Sonal.Sangale |
#9 | 2664654-9.patch | 3.07 KB | Sonal.Sangale |
#4 | 2664654-4.patch | 3.07 KB | phenaproxima |
Comments
Comment #2
dsnopekComment #3
dsnopekComment #4
phenaproximaFirst attempt.
Comment #5
phenaproximaComment #6
dsnopekThanks!
Category should probably be "Content" since that's what we're using for the other blocks that need a node context.
Here too - we use "Content" in the label of other context that take nodes.
Hm. So, I don't know which way is better, but I would have used
\Drupal::service('entity_type.bundle.info')->getBundleInfo('node')
(except properly injected :-)) to get the list of view modes. Directly accessing the config entities seems like we're skipping an abstraction - but maybe it's fine?We should get some feedback from someone who knows the Entity Field API better...
Whoa! Super cool that we don't have to duplicate the code here. :-)
Comment #7
dsnopekActually, thinking about #6.3 some more - I think it's possible for a view mode to exist, but have no config entity for it! This is when the user chooses not to enable custom display settings for a view mode, and the settings for "Default" are re-used. We don't want to have to change block settings depending on if view mode has custom settings or not - we should just set the view mode and the correct display settings get used.
So, I think we should definitely use the 'entity_type.bundle.info' service to get the list of view modes, rather than the config entity.
Comment #8
Sonal.Sangale CreditAttribution: Sonal.Sangale at Blisstering Solutions commentedComment #9
Sonal.Sangale CreditAttribution: Sonal.Sangale at Blisstering Solutions commentedAdded modifications as per comment #6.
Item 1 - Done
Item 2 - Done
Item 3 - I have not changed anything since not much aware of Entity Field API.
Comment #10
Sonal.Sangale CreditAttribution: Sonal.Sangale at Blisstering Solutions commentedComment #11
dsnopekThanks! I still think we should switch to the bundle info per #6.3, but I'd like to do some testing to see if the result is different. I suspect that getting the config entities will be missing the view modes that aren't customized, and we want to be able to select all views, not just the customized ones.
Comment #12
thallesFollow a new patch, fixing Drupal standards.