-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to CRM_Core_Form::setTitle() instead of CRM_Utils_System::setTitle() part 4 #21368
Conversation
(Standard links)
|
@@ -366,10 +366,10 @@ public function templateFile() { | |||
*/ | |||
public function setTitle($title) { | |||
if ($title) { | |||
CRM_Utils_System::setTitle($title); | |||
$this->setTitle($title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause a loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved title changes for legacycustomsearches to #21375 and taken them out of this PR
@@ -162,7 +162,7 @@ public function preProcess() { | |||
CRM_Custom_Form_CustomData::setDefaultValues($this); | |||
} | |||
|
|||
CRM_Utils_System::setTitle(ts('Renew Membership')); | |||
$this->setTitle(ts('Renew Membership')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - checked
@@ -341,7 +341,7 @@ public function preProcess() { | |||
} | |||
|
|||
// 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -77,7 +77,7 @@ public function buildQuickForm() { | |||
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -50,7 +50,7 @@ public function preProcess() { | |||
$session = CRM_Core_Session::singleton(); | |||
$this->_userContext = $session->readUserContext(); | |||
|
|||
CRM_Utils_System::setTitle(ts('Update multiple memberships')); | |||
$this->setTitle(ts('Update multiple memberships')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -44,7 +44,7 @@ public function preProcess() { | |||
$title = ts('Edit Your Personal Campaign Page'); | |||
} | |||
|
|||
CRM_Utils_System::setTitle($title); | |||
$this->setTitle($title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok - checked
@@ -42,7 +42,7 @@ public function setDefaultValues() { | |||
$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])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -100,7 +100,7 @@ public function preProcess() { | |||
$this->assign('pcpComponent', $this->_component); | |||
|
|||
if ($this->_single) { | |||
CRM_Utils_System::setTitle(ts('Update Contact Information')); | |||
$this->setTitle(ts('Update Contact Information')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -54,7 +54,7 @@ public function preProcess() { | |||
|
|||
$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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
I've noted the ones I've checked so they dont need to be rechecked. Test fails relate |
4b6b11d
to
91e8134
Compare
Thanks @eileenmcnaughton I've moved title changes for legacycustomsearches to #21375 and taken them out of this PR as they need a slightly different approach. |
@@ -99,7 +99,7 @@ public function preProcess() { | |||
$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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -50,7 +50,7 @@ public function preProcess() { | |||
|
|||
$this->assign('title', $this->_title); | |||
|
|||
CRM_Utils_System::setTitle(ts('Confirm Price Field Delete')); | |||
$this->setTitle(ts('Confirm Price Field Delete')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -108,7 +108,7 @@ public function preProcess() { | |||
elseif ($this->_action & CRM_Core_Action::VIEW) { | |||
$title = ts('Preview %1', [1 => $title]); | |||
} | |||
CRM_Utils_System::setTitle($title); | |||
$this->setTitle($title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -22,7 +22,7 @@ public function preProcess() { | |||
$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')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -124,7 +124,7 @@ public function preProcess() { | |||
|
|||
// 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -149,7 +149,7 @@ public function preProcess() { | |||
$this->assign('message', $message); | |||
} | |||
else { | |||
CRM_Utils_System::setTitle(ts('New CiviCRM Profile')); | |||
$this->setTitle(ts('New CiviCRM Profile')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -187,7 +187,7 @@ public function source($fileName, $isQueryString = FALSE) { | |||
} | |||
|
|||
public function preProcess() { | |||
CRM_Utils_System::setTitle($this->getTitle()); | |||
$this->setTitle($this->getTitle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checked
@@ -22,7 +22,7 @@ public function __construct(&$formValues) { | |||
* @return void | |||
*/ | |||
public function buildForm(&$form) { | |||
CRM_Utils_System::setTitle(ts('My Search Title')); | |||
$form->setTitle(ts('My Search Title')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok checkedish & it's not live code anyway
these all look good |
Overview
Follows on from some work that @eileenmcnaughton started in 2019. Forms should use
$this->setTitle()
instead ofCRM_Utils_System::setTitle()
because it allows you to use$this->getTitle()
on a form to get the title of the form that the user will see.Before
Calls to
CRM_Utils_System::setTitle()
After
Calls to
$this->setTitle()
Technical Details
As can be observed
CRM_Core_Form::setTitle()
callsCRM_Utils_System::setTitle()
internally after setting$this->_title
showing that this function is a drop-in replacement. There are just over 200 instances that need converting and (for ease of review) this is the final 43.I would suggest that
r-run
testing could be done with a few forms only instead of all of them - what needs to be verified is that it is a form that inherits from CRM_Core_Form (and not eg. a Page).Comments
This is the final one