I was originally expecting to need to flush the menu whenever the
`permission` changed. That's not necessary now (because the true permission
check is deferred until it's needed), but the cleanup may still be helpful
in the future (e.g. if we enable nav-menu integration or change the way
permissions are implemented).
// We may have changed list of files covered by the cache.
_afform_clear();
- if (($item['server_route'] ?? NULL) !== ($orig['server_route'] ?? NULL)) {
+ $isChanged = function($field) use ($item, $orig) {
+ return ($item[$field] ?? NULL) !== ($orig[$field] ?? NULL);
+ };
+ // Right now, permission-checks are completely on-demand.
+ if ($isChanged('server_route') /* || $isChanged('permission') */) {
\CRM_Core_Menu::store();
\CRM_Core_BAO_Navigation::resetNavigation();
}