From 203b4734f10f9d056172ad13cca29fa3deb53586 Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Sun, 5 Sep 2021 20:39:00 +0100
Subject: [PATCH] Switch to CRM_Core_Form::setTitle() instead of
 CRM_Utils_System::setTitle() part 4

---
 CRM/Member/Form/MembershipRenewal.php                       | 2 +-
 CRM/Member/Form/MembershipView.php                          | 2 +-
 CRM/Member/Form/Task/Batch.php                              | 2 +-
 CRM/Member/Form/Task/PickProfile.php                        | 2 +-
 CRM/PCP/Form/Campaign.php                                   | 2 +-
 CRM/PCP/Form/Event.php                                      | 2 +-
 CRM/PCP/Form/PCPAccount.php                                 | 2 +-
 CRM/Pledge/Form/Payment.php                                 | 2 +-
 CRM/Pledge/Form/PledgeView.php                              | 2 +-
 CRM/Price/Form/DeleteField.php                              | 2 +-
 CRM/Price/Form/Set.php                                      | 2 +-
 CRM/Report/Form/Register.php                                | 2 +-
 CRM/UF/Form/Group.php                                       | 4 ++--
 CRM/Upgrade/Form.php                                        | 2 +-
 tests/extensions/test.extension.manager.searchtest/main.php | 2 +-
 15 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php
index 4b0fdbe0720..ff06bbf8664 100644
--- a/CRM/Member/Form/MembershipRenewal.php
+++ b/CRM/Member/Form/MembershipRenewal.php
@@ -162,7 +162,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
       CRM_Custom_Form_CustomData::setDefaultValues($this);
     }
 
-    CRM_Utils_System::setTitle(ts('Renew Membership'));
+    $this->setTitle(ts('Renew Membership'));
 
     parent::preProcess();
   }
diff --git a/CRM/Member/Form/MembershipView.php b/CRM/Member/Form/MembershipView.php
index e376a87824b..8df997d5832 100644
--- a/CRM/Member/Form/MembershipView.php
+++ b/CRM/Member/Form/MembershipView.php
@@ -341,7 +341,7 @@ SELECT r.id, c.id as cid, c.display_name as name, c.job_title as comment,
       }
 
       // omitting contactImage from title for now since the summary overlay css doesn't work outside crm-container
-      CRM_Utils_System::setTitle(ts('View Membership for') . ' ' . $displayName);
+      $this->setTitle(ts('View Membership for') . ' ' . $displayName);
 
       // add viewed membership to recent items list
       $recentTitle = $displayName . ' - ' . ts('Membership Type:') . ' ' . $values['membership_type'];
diff --git a/CRM/Member/Form/Task/Batch.php b/CRM/Member/Form/Task/Batch.php
index 603bd9d3ca5..188fc9232c9 100644
--- a/CRM/Member/Form/Task/Batch.php
+++ b/CRM/Member/Form/Task/Batch.php
@@ -77,7 +77,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task {
       CRM_Core_Error::statusBounce(ts('ufGroupId is missing'));
     }
     $this->_title = ts('Update multiple memberships') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
-    CRM_Utils_System::setTitle($this->_title);
+    $this->setTitle($this->_title);
 
     $this->addDefaultButtons(ts('Save'));
     $this->_fields = [];
diff --git a/CRM/Member/Form/Task/PickProfile.php b/CRM/Member/Form/Task/PickProfile.php
index f8fe9db2454..c74bd95cfd2 100644
--- a/CRM/Member/Form/Task/PickProfile.php
+++ b/CRM/Member/Form/Task/PickProfile.php
@@ -50,7 +50,7 @@ class CRM_Member_Form_Task_PickProfile extends CRM_Member_Form_Task {
     $session = CRM_Core_Session::singleton();
     $this->_userContext = $session->readUserContext();
 
-    CRM_Utils_System::setTitle(ts('Update multiple memberships'));
+    $this->setTitle(ts('Update multiple memberships'));
 
     $validate = FALSE;
     //validations
diff --git a/CRM/PCP/Form/Campaign.php b/CRM/PCP/Form/Campaign.php
index 6445366044a..538300bb4ac 100644
--- a/CRM/PCP/Form/Campaign.php
+++ b/CRM/PCP/Form/Campaign.php
@@ -44,7 +44,7 @@ class CRM_PCP_Form_Campaign extends CRM_Core_Form {
       $title = ts('Edit Your Personal Campaign Page');
     }
 
-    CRM_Utils_System::setTitle($title);
+    $this->setTitle($title);
     parent::preProcess();
   }
 
diff --git a/CRM/PCP/Form/Event.php b/CRM/PCP/Form/Event.php
index 265ee1c623a..3a0f95f7452 100644
--- a/CRM/PCP/Form/Event.php
+++ b/CRM/PCP/Form/Event.php
@@ -42,7 +42,7 @@ class CRM_PCP_Form_Event extends CRM_Event_Form_ManageEvent {
     $defaults = [];
     if (isset($this->_id)) {
       $title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
-      CRM_Utils_System::setTitle(ts('Personal Campaign Page Settings (%1)', [1 => $title]));
+      $this->setTitle(ts('Personal Campaign Page Settings (%1)', [1 => $title]));
 
       $params = ['entity_id' => $this->_id, 'entity_table' => 'civicrm_event'];
       CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $defaults);
diff --git a/CRM/PCP/Form/PCPAccount.php b/CRM/PCP/Form/PCPAccount.php
index 9925bdbf70f..fd148fdd3eb 100644
--- a/CRM/PCP/Form/PCPAccount.php
+++ b/CRM/PCP/Form/PCPAccount.php
@@ -100,7 +100,7 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form {
     $this->assign('pcpComponent', $this->_component);
 
     if ($this->_single) {
-      CRM_Utils_System::setTitle(ts('Update Contact Information'));
+      $this->setTitle(ts('Update Contact Information'));
     }
   }
 
diff --git a/CRM/Pledge/Form/Payment.php b/CRM/Pledge/Form/Payment.php
index 119533b567e..02a7d414745 100644
--- a/CRM/Pledge/Form/Payment.php
+++ b/CRM/Pledge/Form/Payment.php
@@ -54,7 +54,7 @@ class CRM_Pledge_Form_Payment extends CRM_Core_Form {
 
     $this->_id = CRM_Utils_Request::retrieve('ppId', 'Positive', $this);
 
-    CRM_Utils_System::setTitle(ts('Edit Scheduled Pledge Payment'));
+    $this->setTitle(ts('Edit Scheduled Pledge Payment'));
   }
 
   /**
diff --git a/CRM/Pledge/Form/PledgeView.php b/CRM/Pledge/Form/PledgeView.php
index e2095af55ea..a18a84a4665 100644
--- a/CRM/Pledge/Form/PledgeView.php
+++ b/CRM/Pledge/Form/PledgeView.php
@@ -99,7 +99,7 @@ class CRM_Pledge_Form_PledgeView extends CRM_Core_Form {
       $displayName .= ' (' . ts('default organization') . ')';
     }
     // omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
-    CRM_Utils_System::setTitle(ts('View Pledge by') . ' ' . $displayName);
+    $this->setTitle(ts('View Pledge by') . ' ' . $displayName);
 
     // do check for campaigns
     if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
diff --git a/CRM/Price/Form/DeleteField.php b/CRM/Price/Form/DeleteField.php
index b6a961abb86..b9876cc57ba 100644
--- a/CRM/Price/Form/DeleteField.php
+++ b/CRM/Price/Form/DeleteField.php
@@ -50,7 +50,7 @@ class CRM_Price_Form_DeleteField extends CRM_Core_Form {
 
     $this->assign('title', $this->_title);
 
-    CRM_Utils_System::setTitle(ts('Confirm Price Field Delete'));
+    $this->setTitle(ts('Confirm Price Field Delete'));
   }
 
   /**
diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php
index 96a5b53cb34..88a24f76a48 100644
--- a/CRM/Price/Form/Set.php
+++ b/CRM/Price/Form/Set.php
@@ -108,7 +108,7 @@ class CRM_Price_Form_Set extends CRM_Core_Form {
     elseif ($this->_action & CRM_Core_Action::VIEW) {
       $title = ts('Preview %1', [1 => $title]);
     }
-    CRM_Utils_System::setTitle($title);
+    $this->setTitle($title);
 
     $url = CRM_Utils_System::url('civicrm/admin/price', 'reset=1');
     $breadCrumb = [
diff --git a/CRM/Report/Form/Register.php b/CRM/Report/Form/Register.php
index cc1440150e6..f1ccbfc59d9 100644
--- a/CRM/Report/Form/Register.php
+++ b/CRM/Report/Form/Register.php
@@ -22,7 +22,7 @@ class CRM_Report_Form_Register extends CRM_Core_Form {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE);
     $this->_id = CRM_Utils_Request::retrieve('id', 'String', $this, FALSE);
 
-    CRM_Utils_System::setTitle(ts('Report Template'));
+    $this->setTitle(ts('Report Template'));
 
     if ($this->_action & CRM_Core_Action::DELETE) {
       return;
diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php
index 58c9b9f5404..07a03b6267d 100644
--- a/CRM/UF/Form/Group.php
+++ b/CRM/UF/Form/Group.php
@@ -124,7 +124,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
 
     // setting title for html page
     if ($this->_action & CRM_Core_Action::UPDATE) {
-      CRM_Utils_System::setTitle(ts('Profile Settings') . " - $title");
+      $this->setTitle(ts('Profile Settings') . " - $title");
     }
     elseif ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::DELETE)) {
       $ufGroup['module'] = implode(' , ', CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id, TRUE));
@@ -149,7 +149,7 @@ class CRM_UF_Form_Group extends CRM_Core_Form {
       $this->assign('message', $message);
     }
     else {
-      CRM_Utils_System::setTitle(ts('New CiviCRM Profile'));
+      $this->setTitle(ts('New CiviCRM Profile'));
     }
   }
 
diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php
index b8da51a09cc..4d993118e6c 100644
--- a/CRM/Upgrade/Form.php
+++ b/CRM/Upgrade/Form.php
@@ -187,7 +187,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form {
   }
 
   public function preProcess() {
-    CRM_Utils_System::setTitle($this->getTitle());
+    $this->setTitle($this->getTitle());
     if (!$this->verifyPreDBState($errorMessage)) {
       if (!isset($errorMessage)) {
         $errorMessage = 'pre-condition failed for current upgrade step';
diff --git a/tests/extensions/test.extension.manager.searchtest/main.php b/tests/extensions/test.extension.manager.searchtest/main.php
index b1f58e4d2ac..fdb6890dee4 100644
--- a/tests/extensions/test.extension.manager.searchtest/main.php
+++ b/tests/extensions/test.extension.manager.searchtest/main.php
@@ -22,7 +22,7 @@ class test_extension_manager_searchtest extends CRM_Contact_Form_Search_Custom_B
    * @return void
    */
   public function buildForm(&$form) {
-    CRM_Utils_System::setTitle(ts('My Search Title'));
+    $form->setTitle(ts('My Search Title'));
 
     $form->add('text',
       'household_name',
-- 
GitLab