X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FDrupalBase.php;h=115efaebebbec9b58c00eb0b4aef02dc65fa102f;hb=30a3000cc63f6d8858943fc61afa98ec123b60aa;hp=75d04ca71252e942cccc759c2bedf7522b2bc964;hpb=594eddc519b33992b5f046fa91627c87966e2527;p=civicrm-core.git diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 75d04ca712..115efaebeb 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -663,4 +663,24 @@ 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() { + $path = CRM_Utils_System::getUrlPath(); + + // 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; + } + }