By piridium on
By means of a custom module I compile an order form. This module queries all nodes of a specific content type, reads out name, price etc. and provides an order form in a block.
Result: https://mettler-beef.ch/bestellung
Problem: If I change a product (node), the cache (probably) prevents the rebuilding of the form.
Desired solution: Upon saving a product, the cache for the custom form and, if necessary, for the custom block is to be invalidated.
How can I achieve this?
Comments
=-=
The question is best served in the 'module development and code questions' forum. Please edit the post and move it.Thank you.May also want to include your code.
Moved and updated
Thank you, VM. I moved the thread to the 'module development and code questions' section. Also, I attach the relevant part of the code here:
./src/Form/OrderForm.php
./src/Plugin/Block/OrderBlock.php
Can I define some kind of cache-context (I don't even know if it's the right term here) and have a hook_node_save()-function which invalidates this cache-context after editing a product-node?