Problem/Motivation

The config_pages_field twig filter doesn't include the config page tags, which causes an issue when the field value doesn't get updated for users when it's changed on the admin page.

Steps to reproduce

  1. Create a config page with a field.
  2. Render this field in some twig using the config_pages_field twig filter.
  3. Visit the page that contains this twig file with the anonymous user.
  4. Update the config page field value and save the config page.
  5. Open the same page as the anonymous user.
  6. Observe that the field value didn't change.

Proposed resolution

Add the config page cacheable metadata to the output render array.

CommentFileSizeAuthor
#3 config_page_field_cache-3524237-3.patch1.63 KBalt.dev
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

alt.dev created an issue. See original summary.

alt.dev’s picture

Status: Active » Needs review
StatusFileSize
new1.63 KB
webflo’s picture

I had similar issues, especially when a config page (with the required context) did not exist. \Drupal\config_pages\ConfigPagesLoaderService::getFieldView should add "config_pages_list:$type" as a cache tag in the empty case.

webflo changed the visibility of the branch 3524237-with-test to hidden.

webflo changed the visibility of the branch 3524237-with-test to active.

webflo’s picture

@alt.dev I did not what to interfere with your branch. I have created a new MR with a test for this new feature.

  • shumer committed 3ceea174 on 8.x-2.x authored by alt.dev
    Issue #3524237: Added the config_page entity metadata to the...

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

  • shumer committed c71cf155 on 8.x-2.x authored by webflo
    Issue #3524237: Add cacheable metadata to...
    
shumer’s picture

Status: Needs review » Fixed
alt.dev’s picture

Hi @shumer,

I was pleased to see that the patch I provided for this issue was merged, and I'm glad I could contribute to improving the module.

I noticed that credit for the issue resolution wasn't assigned to my Drupal.org profile. As you know, contribution credits are a valuable part of the Drupal community, encouraging participation and recognizing the efforts of individuals. Providing the initial issue report and developing the fix are contributions that are generally credited according to Drupal.org guidelines.

Would you please consider updating the issue credits to include my contribution?

webflo’s picture

shumer’s picture

Status: Fixed » Closed (fixed)

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

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

asherry’s picture

I'd like to request this be re-opened just for a quick fix that's needed. There is a duplicate class use import that's causing an error. I'm not sure how it's not happening for everybody, maybe it's a PHP version issue.

I cherry-picked the commit from this ticket #3327176: Add link to Layout Builder overrides on config page form but the actual origin of the issue was here so I feel like the fix belongs here as well.

shumer’s picture

Thanks for that MR @ashery. The issue I think exists in dev branch only, as we haven't release the new version with the latest fixes.
I'll check this one and the Layout builder fix and hopefully we can release those.