Preprocess entity print

Created on 16 December 2020, almost 4 years ago
Updated 1 February 2024, 10 months ago

Problem/Motivation

The patch introduced in issue 3166397 made it impossible to manipulate webform submission data in hook_preprocess_entity_print. The code added to the file webform_entity_print.module (lines 297 -> 299) overwrites the content variable with a Markup element so you can't retrieve submission data from $variables['content'][0]['#webform_submission'] with the hook anymore.

// The HTML markup is safe because it has already been rendered.
  $content = [
    '#markup' => Markup::create($html),
  ];

Steps to reproduce

Create a custom module hook_preprocess_entity_print and dump $variables with kint

Proposed resolution

🐛 Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

🇧🇪Belgium bartvermeulen1

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy kris77

    This problem is present in Webform 6.1.4 and patch in #11 works again.

    Thanks @vivek.kekare

  • 🇮🇹Italy kris77

    I don't know if it's only my problem, but it seems that Preprocess entity print works only in theme folder.
    I have created a custom module:

    • In mycustom.module file there is mycustom_preprocess_entity_print function
    • In templates folder there is entity-print--webform-submission--test.html.twig for customize pdf
    • Clear cache

    It does not work.
    If move mycustom module folder in my theme or sub theme then it works.

  • 🇮🇹Italy antonio.bertolini

    This problem is present in Webform 6.2.2 and patch in #11 works at line 366.

    It' only 1 row.... why not apply it definitively?... I use entity print submission in 10+ sites it's a waste of time everytimes!

    thanks!
    A.

Production build 0.71.5 2024