I have noticed that on all twig templates the way to add values to the class attribute for the wrapper container is similar to this <{{ outer_wrapper }}{{ attributes.addClass('ds-2col', 'clearfix') }}>
. Which output the following code for me class="contextual-region view-mode-teaser ds-2col clearfix"
. As you can see on this code we are missing information like: node type, unpublished, sticky, etc.
I believe these classes are necessary for a proper style of a site and they used to be present on previous versions of Display Suite module.
Would it be possible to add them back please?
Thank you so much.
Comment | File | Size | Author |
---|---|---|---|
#8 | 2639984-7.patch | 776 bytes | aspilicious |
Comments
Comment #2
aspilicious CreditAttribution: aspilicious commentedI have to look at how core adds those classes... If they still exist in D8
Comment #3
altrugon CreditAttribution: altrugon commented@aspilicious on the Classy theme you can see how those classes get added on node.html.twig.
This is the work around that we have come with so far:
Comment #4
aspilicious CreditAttribution: aspilicious commentedAs each template can be overridden you can add those classes your zelf, not sure if I have to add them by default...
Although thats probably the best idea...
Comment #5
altrugon CreditAttribution: altrugon commentedI did try to do it on the template first like node.html.twig does on the Classy node, however the object node was missing.
Perhaps you are right and these classes shouldn't be added by default since now there is the Stable theme that add not classes at all, but would it be possible to pass the "node" object to the template, or add an option on the UI to have the classes added/removed?
Comment #6
aspilicious CreditAttribution: aspilicious commentedthe templates are entity agnostic, once I have some time I'll try to figure out What the name of the element is holding the entity
Comment #7
aspilicious CreditAttribution: aspilicious commentedYou can print the variables in template_preprocess_ds_entity_view(&$variables) to see what is available.
And you can potentially override template_preprocess_ds_entity_view in your theme function to add what you need.
Comment #8
aspilicious CreditAttribution: aspilicious commentedThe patch in combination with a: ds-2col--node.html.twig does the trick.
So if tests are green I'll commit this patch.
We should probably document this somewhere...
Comment #9
aspilicious CreditAttribution: aspilicious commentedAND comitted, have fun :)