Skip to content

Commit f6e257c

Browse files
authored
Merge pull request #10 from indigoxela/form-submit-cache-flush
Issue #9: flush cache on form submit
2 parents 7948c96 + b7c2108 commit f6e257c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

matomo.admin.inc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,20 @@ function matomo_admin_settings_form($form_state) {
426426
);
427427

428428
$form['#config'] = 'matomo.settings';
429+
$form['#submit'] = array('_matomo_admin_flush_cache');
429430

430431
return system_settings_form($form);
431432
}
432433

434+
/**
435+
* Additional callback on admin form submit.
436+
*
437+
* Flush the page cache as the tracking code visibility could have changed.
438+
*/
439+
function _matomo_admin_flush_cache() {
440+
cache_flush('page');
441+
}
442+
433443
function matomo_admin_settings_form_validate($form, &$form_state) {
434444
// Custom variables validation.
435445
foreach ($form_state['values']['custom_var']['slots'] as $custom_var) {

0 commit comments

Comments
 (0)