Skip to content
Snippets Groups Projects
Commit 5d8acb3f authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-4523: adding cache busting for information for menu when new menu link is added

parent 7d3122fe
No related branches found
No related tags found
1 merge request!25ISTWCMS-4523: adding cache busting for information for menu when new menu link is added
...@@ -9,6 +9,26 @@ use Drupal\Core\Form\FormStateInterface; ...@@ -9,6 +9,26 @@ use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\WebformInterface; use Drupal\webform\WebformInterface;
use Drupal\webform\WebformSubmissionStorageInterface; use Drupal\webform\WebformSubmissionStorageInterface;
/**
* Implements hook_entity_presave().
*/
function uw_cfg_common_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
// Check if we are on a menu link.
if ($entity->getEntityTypeId() == 'menu_link_content') {
// Check that we are on a Information For (audience) link.
if ($entity->menu_name->getValue()[0]['value'] == 'uw-menu-audience-menu') {
// Invalid all the menu caching.
\Drupal::cache('menu')->invalidateAll();
// Rebuild all the menus.
\Drupal::service('plugin.manager.menu.link')->rebuild();
}
}
}
/** /**
* Implements hook_form_FORM_ID_alter(). * Implements hook_form_FORM_ID_alter().
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment