0

I want to set the cache settings for a block that I build by module. I know how to set the cache settings for the build array, but I am not able to find a possibility to modify the cache of the block itself. (label / twig)

The theme of the block does output a form by receiving an array. This array is language specific. I need to set the cache to "language specific" or turn if off completely. But how?

Thanks.

1

Everything that is render cached in Drupal is by default varied by interface language specific.

If that's not enough and you have different interface and content language for example, you need to use cache contexts. Which works exactly like anywhere else, with $form['#cache']['contexts'], see https://www.drupal.org/docs/8/api/cache-api/cache-contexts for more information.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.