Needs review
Project:
Chaos Tool Suite (ctools)
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Feb 2016 at 14:30 UTC
Updated:
5 Dec 2019 at 19:19 UTC
Jump to comment: Most recent, Most recent file
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 commentedComment #9
Sonal.Sangale 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 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.