Drupal 8 preprocess page
I'm new in Drupal 8 & I have an issue. I need to display a CCK field (custom field) in my theme page page-front.html.twig. As I understand it's impossible to display node variables in a non-node page, so I start to do a preprocess hook. My preprocess looks like this: mythemename.theme <?php function THEME_NAME_preprocess_page(&$vars) { if (isset($vars['node'])) { $node = $vars['node']; if ($node->isset('field_numero_cin') { $field_cin = $node->get('field_numero_cin'); $vars['field_cin'] = $field_image->value(); } } } Unfortunately, when I'm debugging (kint) my variable in page-front.html.twig
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.