0

To simplify this issue, I just have 2 hooks:

1. customtheme_preprocess_paragraph__registration_button()
2. customtheme_preprocess_paragraph__registration_button__default()

When I access a node with a registration button with a default view mode, only the first hook is called. Also, when I access the $variables['view_mode'] in that hook, it gives the value 'default'.

Furthermore, it only takes the paragraph--registration-button.html.twig as template, but not paragraph--registration-button--default.html.twig

I am using Drupal Core 9.5.4 and Paragraphs 1.15.0. Could this be something in my setup?

8
  • default view mode is used as placeholder value for empty, unset... It seems very weird to overwrite the default template with another default template.
    – Hudri
    Mar 10, 2023 at 14:29
  • This happened for every view mode, no matter the name. For example, the sidebar view mode did not trigger the customtheme_preprocess_paragraph__registration_button__sidebar() hook, nor did it show the paragraph--registration-button--sidebar.html.twig template. Instead it is using the basic hook without any view modes and the basic template, as written in the description above. Mar 10, 2023 at 14:34
  • If I recall correctly, that's a bug in Paragraphs. It was a few years ago at least.
    – Jaypan
    Mar 10, 2023 at 16:02
  • Does this hook exist at all? I know of hook_preprocess_paragraph__BUNDLE(), but I've never used a hook_preprocess_paragraph__VIEWMODE()
    – Hudri
    Mar 10, 2023 at 18:00
  • Just to be totally sure, you've cleared caches? Mar 10, 2023 at 18:11

1 Answer 1

0

This can be closed, it was a custom setup.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.