-
Notifications
You must be signed in to change notification settings - Fork 19
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
Adding cache tags #2
base: 8.x-2.x
Are you sure you want to change the base?
Conversation
Should also include cache contexts and max-age. Try using something like CacheableMetadata::createFromObject($view)->applyTo($build); |
That said, a lot here looks unported. the #type there doesn't do anyting because it has not been ported, so the only reason it does something at all is because the code additionally also hardcodes the #theme. I would recommend to build the initial render array like this:
the argument parsing logic would have to change from a pre render callback to be done in the formatter. IMHO, that would be much easier to follow & understand. If necessary, the template could be kept as a wrapper template around the view. |
Alright, tried to implement this. Does this look right? Is the usage of _viewfield_get_view_args() ok inside ViewfieldDefaultFormatter? |
After updating core and contrib i kept getting this error:
Switching back to my original approach solved it. Any idea why this happens? |
@luksak , by "Switching back to my original approach solved it," do you mean reverting ce911e4? Because I ran into a problem with using my fork where new content does not invalidate the node containing the viewfield. Once I added cache tags like in e45a3a6, it worked perfectly. (FYI the site's core is 8.1.8) |
Fixed deprecated code.
I added cache tags. This needs tests.