Colorbox settings form needs cache invalidation

Created on 16 August 2021, almost 3 years ago
Updated 30 May 2024, 27 days ago

Problem/Motivation

When using the colorbox formatter in a view, the view needs to be rebuild after the colorbox settings form has been submitted. Otherwise the changes won't appear until the view's cache has expired or the view is being edited and saved manually.

Steps to reproduce

1. Create a view with fields and at least one image field.
2. Use the colorbox formatter for the image field.
3. Save and try out the view
4. Change either of the colorbox setting form settings (at /admin/config/media/colorbox)
5. Save the settings and go back to the view. The changes are not reflected, until site cache is rebuilt or the view is edited and saved manually.

Proposed resolution

In the ColorboxSettingsForm.php submit function, the caches should be invalidated, for all items that uses the colorbox formatter. I don't know if that's possible, but a general way to do it could be by adding the lines:

\Drupal::service('cache.render')->invalidateAll();
\Drupal\Core\Cache\Cache::invalidateTags(array("node_list"));

.. after the $config->save();

Does anyone know of a better way to do that?

Remaining tasks

1. Figure out the best way to invalidate the right caches.
2. Write a patch

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

🇩🇰Denmark prinds

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024