Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using ECK with Bricks on a site, and having recently updated to alpha5 got a screen full of very verbose warnings. I was already using overridden templates for Bricks, so I adjusted my versions to use {{ content }}
instead of {{ entity }}
, but it seems the warnings will continue to display unless the original template for Bricks is changed, even though in practice that won't be used. Can this be corrected, so that the warnings only display if the active template is using {{ entity }}
?
Comment | File | Size | Author |
---|---|---|---|
#10 | deprecated-eck-entity.patch | 920 bytes | tengoku |
#8 | 3008553-deprecated-eck-entity-variable-#8.patch | 1.29 KB | ToxaViking |
Comments
Comment #2
legolasboThanks for reporting this @mandclu,
I am going to need some more information about your configuration to be able to reproduce this. Preferably with step by step instructions detailing how to reproduce this issue on a vanilla Drupal installation. This information should at least contain the following.
Comment #3
mandclu CreditAttribution: mandclu at Northern Commerce commentedOf course, I'm happy to help.
There are a number of modules installed, but you should be able to reproduce it using just bricks and and its submodule bricks_default, including the latter's dependencies, which include ECK.
In your theme override eck-entity--brick.html.twig so that it displays
{{ content }}
instead of{{ entity }}
. Bricks_default will have created a demo page with lots of bricks placed, which should be sufficient to observe the behaviour I'm reporting. When you visit the page, to see the content you will scroll past multiple messages like the one below:I totally understand the desire to warn the admins of the site, but I have a number of issues with the implementation of the deprecation warning that was added to alpha5 of ECK:
Comment #4
mandclu CreditAttribution: mandclu at Northern Commerce commentedI'll add one more thing: If you go into the Bricks module and change eck-entity--brick.html.twig to use
{{ content }}
, all the warning go away, even though that template was already overridden.Comment #5
legolasboI've been able to reproduce this issue reliably and have determined that it's caused by the Bricks module which accesses the `entity` variable in it's preprocess function. Specifically this one around line 85 in
bricks.module
:Changing this to
fixes the issue.
I'll provide a patch shortly.
Comment #6
legolasboCorrect module this time
Comment #7
legolasboI just checked out the latest development version of Bricks to be able to create a patch and noticed that it no longer preprocesses eck entities, nor does it provide a default template. It therefore doesn't throw any deprecation warnings. Your problem should be fixed by upgrading to the latest dev version of Bricks.
Looking at the high number of commits in the dev branch, bricks could actually use a new stable release, but that would need to be requested in another issue.
Comment #8
ToxaViking CreditAttribution: ToxaViking as a volunteer and at Lemberg Solutions, Drupal Ukraine Community commentedLeave this patch here to add into composer.json
Comment #10
tengokuI cant apply #8 to composer because it's mixing two projects. I'm leaving a patch with just the bricks portion that modifies bricks.module.