- Issue created by @artemskliarcz
Hello.
Is it posible to get access to group object values (When I on group page) in page.html.twig template?
Such functionality you need, for example, if you add custom image field for node or group, but you need to show this image before content of your "page type". For example "Hero area", before breadcrumbs, sidebar and main ... so you must change your page.html.twig structure. It's working for "node" variables, but not working for "group" variables.
In page.html.twig I can use "node" object variables (when I on node page /node/333), for example {{ node.some_custom_img_field.entity.uri.value }},
but I can't use in page.html.twig "group" object variables (When I on group page /group/12), for example {{ group.some_custom_img_field.entity.uri.value }}
I check group object via {{ dump(group) }} in page.html.twig and I have "0 null". But, if I do the same on group-full.html.twig - I have success with "group" object values.
I use $group = \Drupal::request()->attributes->get('group'); in theme_preprocess_page and theme_preprocess_html to add some classnames to body tag , using conditions with fields values via $group->get('field_name')->getValue() and I have a success with it.
But I have no success with using twig variables for group ({{ group.field...value }}) in page.html.twig ... but node variables ({{ node.field...value }}) is working fine.
It posible to resolve this problem? I need access to group values in page.html.twig file.
Thank you.
Active
1.6
Code