It seems like field divs output through a basic-based template are missing attributes. I just tested on a pretty clean d8 install, with a fresh download of the 8.x-1.2 version, and I saw one attribute for the body field div:
<div property="schema:text">...</div>
The image field div had no attributes at all. It looks like it's not a problem with the template, because when I'm logged in, I see the in-place-editing classes. It's as if the field attributes are being reset in the preprocess. I do see that there is a hook_field_preprocess function in basic.theme. Is it possible that identifying field-classes are being removed by this function?
I see the full array of div attributes when I switch to Bartik.
Comments
Comment #2
safetypinComment #3
joelpittetCould you post the output of bartik and basic output of the same div in the issue summary please?
Comment #4
safetypinBartik:
Basic:
Comment #5
safetypinI'm seeing a similar issue with Views container divs. This one has the generic classes, but none of the view-specific classes. like "view-id-gallery"
In Bartik:
And in Basic:
Comment #6
joelpittetAh that's because we are extending from Stable base theme. We are trying to avoid adding unnecessary and opinionated core classes to Basic, to keep it as "basic" and blank canvas like as we can. You can add them back by copying the field.html.twig template from Classy.
Feel free to re-open if you have some oversight bug that we have overlooked?
Comment #7
safetypinThank you!
Comment #8
calbasiHi,
Could we, as alternative to copy the field.html.twig template from Classy, just add this line at basic.info.yml:
base theme: classy
or perhaps this could have unexpected and / or undesired behavior?
Thanks a lot.
Ps.: I like KISS concept, and basic stuff, but having some field classes could be helpful.
Comment #9
calbasiI think there is a better option which is, in fact, integrated at basic code from some months ago: https://www.drupal.org/node/2728881 (just uncomment few lines, and this enable some classes using BEM syntax... it could be done at field and node twig templates.