Skip to content
Snippets Groups Projects
Unverified Commit 81144b6d authored by totten's avatar totten Committed by GitHub
Browse files

Merge pull request #14876 from eileenmcnaughton/is_front

#378 Determine front end pages in drupal
parents 812950b5 68e3bc34
Branches
Tags
No related merge requests found
......@@ -414,6 +414,19 @@ abstract class CRM_Utils_System_Base {
return FALSE;
}
/**
* Is a front end page being accessed.
*
* Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
*
* @todo Drupal uses the is_public setting - clarify & rationalise. See https://github.com/civicrm/civicrm-drupal/pull/546/files
*
* @return bool
*/
public function isFrontEndPage() {
return CRM_Core_Config::singleton()->userFrameworkFrontend;
}
/**
* Get user login URL for hosting CMS (method declared in each CMS system class)
*
......
......@@ -663,4 +663,26 @@ abstract class CRM_Utils_System_DrupalBase extends CRM_Utils_System_Base {
return (!empty($language->language)) ? $language->language : $language;
}
/**
* Is a front end page being accessed.
*
* Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
*
* See https://github.com/civicrm/civicrm-drupal/pull/546/files
*
* @return bool
*/
public function isFrontEndPage() {
// Get the menu items.
$args = explode('?', $_GET['q']);
$path = $args[0];
// Get the menu for above URL.
$item = CRM_Core_Menu::get($path);
if (!empty(CRM_Utils_Array::value('is_public', $item))) {
return TRUE;
}
return FALSE;
}
}
......@@ -85,7 +85,7 @@ class Themes {
if ($this->activeThemeKey === NULL) {
// Ambivalent: is it better to use $config->userFrameworkFrontend or $template->get('urlIsPublic')?
$config = \CRM_Core_Config::singleton();
$settingKey = $config->userFrameworkFrontend ? 'theme_frontend' : 'theme_backend';
$settingKey = $config->userSystem->isFrontEndPage() ? 'theme_frontend' : 'theme_backend';
$themeKey = Civi::settings()->get($settingKey);
if ($themeKey === 'default') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment