Skip to content

Commit

Permalink
Merge pull request #535 from civicrm/MAE-633-check-empty-menu
Browse files Browse the repository at this point in the history
MAE-633: Regenerate CiviCRM menu if it is empty
  • Loading branch information
lisandro-compucorp authored Mar 22, 2022
2 parents 225e663 + 46c3e49 commit 1719ecd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions shoreditch.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,13 @@ function shoreditch_civicrm_navigationMenu(&$menu) {
* TRUE if Shoreditch is the active theme.
*/
function _shoreditch_isActive() {
// The Job civicrm_api3_job_cleanup can clear the DB cache, causing the
// CiviCRM menu to be empty on the first load after the command ran.
// Without the menu, the getActiveThemeKey is unable to detect the current
// theme. This condition ensures the menu is filled.
if (!CRM_Core_DAO::checkTableHasData(CRM_Core_DAO_Menu::getTableName())) {
CRM_Core_Menu::store(FALSE);
}

return Civi::service('themes')->getActiveThemeKey() === 'shoreditch';
}

0 comments on commit 1719ecd

Please sign in to comment.