On Drupal 8.8.5
When I upgrade the Entity Construction Kit (ECK) module from 8.x-1.0-beta1 to 8.x-1.0-beta2
I get multipuls of the following error message:

User depreciated function:
You are using the 'entity' variable in your eck-entity template.
You should use 'content' instead.
The 'entity' variable will be removed before the release of 8.x-1.0-beta1 in Drupal\eck\ArrayDepreciationWrapper->offsetExists()
(line 45 of modules/contrib/eck/src/ArrayDepreciationWrapper.php).

this also has

(line 80 of modules/contrib/eck/src/ArrayDepreciationWrapper.php).

I have tried putting it on my test system with Drupal 8.9.0 and I am getting the same error.

Which template file is it looking at? ( Where is the template file?)
How do I fix this so I dont get this error going forward?
Thank you

CommentFileSizeAuthor
#5 3153909-5.patch623 bytesmatroskeen

Comments

Thuthuka created an issue. See original summary.

legolasbo’s picture

Issue tags: -eck-entity, -template, -content

Take a look at issue #3007181. That error was introduced there to warn people that are still using the deprecated 'entity' key in their templates/preprocess functions. You should be using the 'content' key instead.

thuthuka’s picture

Hi legolasbo
Thanks for the pointer to the issue https://www.drupal.org/project/eck/issues/3007181

Just for any one else who ends up here:

The eck template that should be under
modules/contrib/eck/templates/eck-entity.html.twig
may contain

<div{{ attributes.addClass(classes) }}>
    {{ entity }}".
</div>

needs to be changed to

<div{{ attributes.addClass(classes) }}>
    {{ content }}
</div>

In my case the "Bricks Default" module requires eck (Entity Construction Kit)
and this was already set in the template under

modules/contrib/bricks/templates/eck-entity--brick.html.twig
and contained

<div {{ attributes }}>
{{ entity }}
</div>

and I had to change it to

<div {{ attributes }}>
{{ content }}
</div>
legolasbo’s picture

@Thuthuka,

I'd like to recommend that you open an issue for the "Bricks Default" module to change their template.

matroskeen’s picture

Title: Using 'entity' variable in eck-entity template. » Remove deprecated 'entity' variable from eck-entity template
Status: Active » Needs review
StatusFileSize
new623 bytes

The deprecation message says "The 'entity' variable will be removed before the release of 8.x-1.0-beta1", but we're already at beta2, so it should be safe to remove it already...

Let's do it here ;)

  • Matroskeen committed 7e09ee4 on 8.x-1.x
    Issue #3153909 by Matroskeen, Thuthuka, legolasbo: Remove deprecated '...
matroskeen’s picture

Status: Needs review » Fixed

Committed to 8.x-1.x.
I don't think there is anything else to do here.

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hongpong’s picture

If anyone lands here: if you have "User deprecated function: You are using the 'entity' variable in your eck-entity template. You should use 'content' instead."

Just noting inside any function in the theme doing preprocess_eck_entity(&$variables) that may be $variables['entity'] and should be updated to $variables['content'] to resolve this, as well as any references like {{ entity }} above in the twig files.