Commit 5f1ff5cf authored by totten's avatar totten
Browse files

(REF) AfformSaveTrait - Extract helper $isChanged

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).
parent 0e4ba120
......@@ -63,7 +63,11 @@ trait AfformSaveTrait {
// 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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment