-
Notifications
You must be signed in to change notification settings - Fork 203
feat: Add Support for App Router Invalidation by Tag in Drupal Module (#812) #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
| $tags[] = $entity->getEntityTypeId() . '_list'; | ||
| $tags[] = $entity->getEntityTypeId() . '_list:' . $entity->bundle(); | ||
| } | ||
| $cache_tags = implode(',', $entity->getCacheTags()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@minnur I think the entity list tags we still have to add manually, at least in my test for nodes for example $entity->getCacheTags only gave node:8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! I added that to the plugin. See db2690b
I noticed $entity->getEntityType()->getListCacheTags(); does not have entity_type_list:bundle. So I looked at \Drupal\Entity\EntityBase class and found a method getListCacheTagsToInvalidate() that adds that to the invalidation list and implemented the same logic in the plugin.
robdecker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
| $list_tags = $entity->getEntityType()->getListCacheTags(); | ||
| if ($entity->getEntityType()->hasKey('bundle')) { | ||
| $list_tags[] = $entity->getEntityTypeId() . '_list:' . $entity->bundle(); | ||
| } | ||
| $combined_tags = array_merge($entity->getCacheTags(), $list_tags); | ||
| $cache_tags = implode(',', $combined_tags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. It is much more concise than our original version.


…
This pull request is for: (mark with an "x")
examples/*modules/nextpackages/next-drupalstarters/basic-starterstarters/graphql-starterstarters/pages-starterGitHub Issue: #812
Describe your changes
Added new cache tag revalidator plugin to the next module.