79546634

Date: 2025-03-31 15:34:40
Score: 2
Natty:
Report link

This preprocess function works if it helps others:

YOURTHEME.theme:

function YOURTHEME_preprocess_paragraph(&$variables){
   $node = \Drupal::request()->attributes->get('node');
   $variables['content_type'] = $node->getType();
}

paragraph.html.twig:

{{ content_type }}

Inspired by https://createdbycocoon.com/knowledge/get-node-values-paragraph-templates-twig-drupal-8

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: User301276