Problem/Motivation

Field cache is not preserved when using the filter.

Steps to reproduce

In a twig template using the filter, dump the field and the same field with filter applied.

No cache parameters from the field are displayed.

Proposed resolution

Add/modify tests to check the cache for the filter.

Call the renderer service to propagate the field cableable metadata.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Aaron Gil Martinez created an issue. See original summary.

aaron gil martinez’s picture

Assigned: aaron gil martinez » Unassigned
Status: Active » Needs review
aaron gil martinez’s picture

sardara’s picture

Status: Needs review » Reviewed & tested by the community

I've tested the pull request and it works correctly.

grevil made their first commit to this issue’s fork.

grevil’s picture

Version: 2.0.2 » 2.0.x-dev

Looks great!

Thanks a lot for the great test coverage! RTBC + 1 🙂👍

Only did some deprecation adjustments, as this module is D11 ready now!

grevil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

m4olivei’s picture

Hey there 👋. Just curious, does this update to the module mean that the following docs on the project page no longer apply? That is to say, on a quick read of the 2.x code it looks like cacheability metadata is now properly accounted for when using field_raw and field_target_entity

Cache warning

The field_raw and field_target_entity filters do not provide any cache information. Without additional measures content printed with these filters will not be update when changed in the backend. You can workaround this by rendering the field in your template but not display the result. For example: {% set catch_cache = content.field_image|render %}