From 5af8c999f3676a6690d6963b945c14b617e45a0a Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 18 Nov 2013 11:12:36 -0800 Subject: [PATCH] CRM-10693 - Ajax - Fetch more accurate page title --- CRM/Core/Config.php | 2 +- CRM/Core/Controller.php | 2 +- CRM/Core/QuickForm/Action/Display.php | 2 +- CRM/Utils/System.php | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index 377cec0afe..ee12caba08 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -167,7 +167,7 @@ class CRM_Core_Config extends CRM_Core_Config_Variables { * @param $loadFromDB boolean whether to load from the database * @param $force boolean whether to force a reconstruction * - * @return object + * @return CRM_Core_Config * @static */ static function &singleton($loadFromDB = TRUE, $force = FALSE) { diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 7bf8d8c7c6..21a4ac461b 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -53,7 +53,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * * @var string */ - public $_title; + protected $_title; /** * The key associated with this controller diff --git a/CRM/Core/QuickForm/Action/Display.php b/CRM/Core/QuickForm/Action/Display.php index 7302b26d24..ad9cc91873 100644 --- a/CRM/Core/QuickForm/Action/Display.php +++ b/CRM/Core/QuickForm/Action/Display.php @@ -159,7 +159,7 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action { if ($controller->_QFResponseType == 'json') { $response = array( 'content' => $html, - 'title' => $controller->_title, + 'title' => CRM_Utils_System::$title, ); if (!empty($form['errors'])) { $response['status'] = 'form_error'; diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 3883d6a744..06ff598a79 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -41,6 +41,11 @@ class CRM_Utils_System { static $_callbacks = NULL; + /** + * @var string Page title + */ + static $title = ''; + /** * Compose a new url string from the current url string * Used by all the framework components, specifically, @@ -293,6 +298,7 @@ class CRM_Utils_System { * @static */ static function setTitle($title, $pageTitle = NULL) { + self::$title = $title; $config = CRM_Core_Config::singleton(); return $config->userSystem->setTitle($title, $pageTitle); } -- 2.25.1