Timeline for How to vary classes depending on content type?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 28, 2018 at 20:47 | history | edited | Prestosaurus | CC BY-SA 4.0 |
added 69 characters in body
|
Sep 21, 2018 at 21:21 | history | edited | Prestosaurus | CC BY-SA 4.0 |
deleted 9 characters in body
|
Feb 1, 2018 at 17:15 | comment | added | Prestosaurus | I was looking myself and will try some more when I can. node.type.entity.machine_name looks like the right idea. Also I am always a fan of {{ dump(node | keys) }}, it's a lot lighter than kint. {{ dump(_context | keys) }} is a quick way to see everything available such as 'node', 'elements', 'content'... | |
Jan 31, 2018 at 18:11 | vote | accept | ACanadianCoder | ||
Jan 31, 2018 at 16:36 | comment | added | ACanadianCoder | Awesome...that works and looks much nicer...however, instead of using the label, is there a way of using the machine name? ex. node.type.entity.machine_name == 'program'. Sorry for being so picky. | |
Jan 31, 2018 at 16:12 | comment | added | Prestosaurus | updated my answer with two options, credit to @cchen too | |
Jan 31, 2018 at 16:09 | history | edited | Prestosaurus | CC BY-SA 3.0 |
added 199 characters in body
|
Jan 31, 2018 at 15:41 | comment | added | ACanadianCoder | I ended up just using your method mentioned above but used {% if node.bundle == 'program' %} and that seemed to work. I still think there's a more elegant way of doing it similar to what @cchen had suggested in the above post but this will work for now. Thanks again! | |
Jan 31, 2018 at 15:09 | comment | added | ACanadianCoder | I've added my kint screengrab to the original post from my page.html.twig file. Does any of that help? | |
Jan 30, 2018 at 22:12 | history | answered | Prestosaurus | CC BY-SA 3.0 |