X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FSystem%2FDrupalBase.php;h=2c484a5059d426c3e6914c8c4aeac07a8b50ecc1;hb=54744051dea726c2b1495f24fc1cf7ba7fa25e11;hp=75d04ca71252e942cccc759c2bedf7522b2bc964;hpb=144dacf19067161923f93ddd7178bb938b04c969;p=civicrm-core.git diff --git a/CRM/Utils/System/DrupalBase.php b/CRM/Utils/System/DrupalBase.php index 75d04ca712..2c484a5059 100644 --- a/CRM/Utils/System/DrupalBase.php +++ b/CRM/Utils/System/DrupalBase.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2019 | + | Copyright CiviCRM LLC (c) 2004-2020 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2019 + * @copyright CiviCRM LLC (c) 2004-2020 * $Id$ * */ @@ -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; + } + }