Skip to content

Commit

Permalink
Switch to CRM_Core_Form::setTitle() instead of CRM_Utils_System::setT…
Browse files Browse the repository at this point in the history
…itle() part 2
  • Loading branch information
mattwire committed Sep 2, 2021
1 parent e54e226 commit 7e2e255
Show file tree
Hide file tree
Showing 34 changed files with 51 additions and 48 deletions.
4 changes: 2 additions & 2 deletions CRM/Case/Form/ActivityToCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public function preProcess() {

switch (CRM_Utils_Request::retrieve('fileOnCaseAction', 'String')) {
case 'move':
CRM_Utils_System::setTitle(ts('Move to Case'));
$this->setTitle(ts('Move to Case'));
break;

case 'copy':
CRM_Utils_System::setTitle(ts('Copy to Case'));
$this->setTitle(ts('Copy to Case'));
break;

}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/ActivityView.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function preProcess() {
}

if ($revs) {
CRM_Utils_System::setTitle(ts('Activity Revision History'));
$this->setTitle(ts('Activity Revision History'));
$this->assign('revs', $revs);
$this->assign('result', $viewPriorActivities);
$this->assign('subject', $activitySubject);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function preProcess() {

$details = CRM_Case_PseudoConstant::caseActivityType(FALSE);

CRM_Utils_System::setTitle($details[$this->_activityTypeId]['label']);
$this->setTitle($details[$this->_activityTypeId]['label']);
$this->assign('activityType', $details[$this->_activityTypeId]['label']);
$this->assign('activityTypeDescription', $details[$this->_activityTypeId]['description']);

Expand Down
4 changes: 2 additions & 2 deletions CRM/Case/Form/CaseView.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function preProcess() {
}
$this->assign('relatedCases', $relatedCases);
$this->assign('showRelatedCases', TRUE);
CRM_Utils_System::setTitle(ts('Related Cases'));
$this->setTitle(ts('Related Cases'));
return;
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public function preProcess() {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
$this->assign('displayName', $displayName);

CRM_Utils_System::setTitle($displayName . ' - ' . $caseType);
$this->setTitle($displayName . ' - ' . $caseType);

$recentOther = [];
if (CRM_Core_Permission::checkActionPermission('CiviCase', CRM_Core_Action::DELETE)) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function preProcess() {
// Array contains only one item
foreach ($groupTree as $groupValues) {
$this->_customTitle = $groupValues['title'];
CRM_Utils_System::setTitle(ts('Edit %1', [1 => $groupValues['title']]));
$this->setTitle(ts('Edit %1', [1 => $groupValues['title']]));
}

$this->_defaults = [];
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function preProcess() {
);
$typeLabel = implode(' / ', $typeLabel);

CRM_Utils_System::setTitle(ts('New %1', [1 => $typeLabel]));
$this->setTitle(ts('New %1', [1 => $typeLabel]));
$session->pushUserContext(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
$this->_contactId = NULL;
}
Expand Down Expand Up @@ -221,7 +221,7 @@ public function preProcess() {
}

// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle($displayName);
$this->setTitle($displayName);
$context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);

Expand Down
8 changes: 4 additions & 4 deletions CRM/Contact/Form/CustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ public function preProcess() {
$groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_groupID);
switch ($mode) {
case 'add':
CRM_Utils_System::setTitle(ts('Add %1', [1 => $groupTitle]));
$this->setTitle(ts('Add %1', [1 => $groupTitle]));
break;

case 'edit':
CRM_Utils_System::setTitle(ts('Edit %1', [1 => $groupTitle]));
$this->setTitle(ts('Edit %1', [1 => $groupTitle]));
break;

case 'copy':
CRM_Utils_System::setTitle(ts('Copy %1', [1 => $groupTitle]));
$this->setTitle(ts('Copy %1', [1 => $groupTitle]));
break;
}

Expand All @@ -138,7 +138,7 @@ public function preProcess() {
$this->assign('contact_type', $this->_contactType);
$this->assign('contact_subtype', $this->_contactSubType);
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
$this->setTitle($displayName, $contactImage . ' ' . $displayName);

// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getDefaultContext() {
}

public function preProcess() {
CRM_Utils_System::setTitle(ts('Organization Address and Contact Info'));
$this->setTitle(ts('Organization Address and Contact Info'));
$breadCrumbPath = CRM_Utils_System::url('civicrm/admin', 'reset=1');
CRM_Utils_System::appendBreadCrumb(ts('Administer CiviCRM'), $breadCrumbPath);
$session = CRM_Core_Session::singleton();
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Merge.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function addRules() {

public function buildQuickForm() {
$this->unsavedChangesWarn = FALSE;
CRM_Utils_System::setTitle(ts('Merge %1 contacts', [1 => $this->_contactType]));
$this->setTitle(ts('Merge %1 contacts', [1 => $this->_contactType]));
$buttons = [];

$buttons[] = [
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/RelatedContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function preProcess() {
}

list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_contactId);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
$this->setTitle($displayName, $contactImage . ' ' . $displayName);
}
else {
CRM_Core_Error::statusBounce(ts('Could not get a contact_id and/or contact_type'));
Expand Down
8 changes: 4 additions & 4 deletions CRM/Contact/Form/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ public function preProcess() {
// Set page title based on action
switch ($this->_action) {
case CRM_Core_Action::VIEW:
CRM_Utils_System::setTitle(ts('View Relationship for %1', [1 => $this->_display_name_a]));
$this->setTitle(ts('View Relationship for %1', [1 => $this->_display_name_a]));
break;

case CRM_Core_Action::ADD:
CRM_Utils_System::setTitle(ts('Add Relationship for %1', [1 => $this->_display_name_a]));
$this->setTitle(ts('Add Relationship for %1', [1 => $this->_display_name_a]));
break;

case CRM_Core_Action::UPDATE:
CRM_Utils_System::setTitle(ts('Edit Relationship for %1', [1 => $this->_display_name_a]));
$this->setTitle(ts('Edit Relationship for %1', [1 => $this->_display_name_a]));
break;

case CRM_Core_Action::DELETE:
CRM_Utils_System::setTitle(ts('Delete Relationship for %1', [1 => $this->_display_name_a]));
$this->setTitle(ts('Delete Relationship for %1', [1 => $this->_display_name_a]));
break;
}

Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public function buildQuickForm() {
}

// Set dynamic page title for 'Show Members of Group'
CRM_Utils_System::setTitle(ts('Contacts in Group: %1', [1 => $this->_group[$this->_groupID]]));
$this->setTitle(ts('Contacts in Group: %1', [1 => $this->_group[$this->_groupID]]));
}

$group_contact_status = [];
Expand Down Expand Up @@ -464,7 +464,7 @@ public function buildQuickForm() {
}

// Set dynamic page title for 'Add Members Group'
CRM_Utils_System::setTitle(ts('Add to Group: %1', [1 => $this->_group[$this->_amtgID]]));
$this->setTitle(ts('Add to Group: %1', [1 => $this->_group[$this->_amtgID]]));
// also set the group title and freeze the action task with Add Members to Group
$groupValues = ['id' => $this->_amtgID, 'title' => $this->_group[$this->_amtgID]];
$this->assign_by_ref('group', $groupValues);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Task/AddToGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public function buildQuickForm() {

// Set dynamic page title for 'Add Members Group (confirm)'
if ($this->_id) {
CRM_Utils_System::setTitle(ts('Add Contacts: %1', [1 => $this->_title]));
$this->setTitle(ts('Add Contacts: %1', [1 => $this->_title]));
}
else {
CRM_Utils_System::setTitle(ts('Add Contacts to A Group'));
$this->setTitle(ts('Add Contacts to A Group'));
}

$this->addDefaultButtons(ts('Add to Group'));
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/AddToParentClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function preProcess() {

public function buildQuickForm() {
$contactType = $this->get('contactType');
CRM_Utils_System::setTitle(ts('Add Contacts to %1', [1 => $contactType]));
$this->setTitle(ts('Add Contacts to %1', [1 => $contactType]));
$this->addElement('text', 'name', ts('Find Target %1', [1 => $contactType]));

$this->add('select',
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function buildQuickForm() {
CRM_Core_Error::statusBounce(ts('ufGroupId is missing'));
}
$this->_title = ts('Update multiple contacts') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->setTitle($this->_title);

$this->addDefaultButtons(ts('Save'));
$this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function preProcess() {
$this->assign('restore', $this->_restore);

if ($this->_restore) {
CRM_Utils_System::setTitle(ts('Restore Contact'));
$this->setTitle(ts('Restore Contact'));
}

if ($cid) {
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contact/Form/Task/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public function preProcess() {
$displayName[] = CRM_Contact_BAO_Contact::displayName($val);
}

CRM_Utils_System::setTitle(implode(',', $displayName) . ' - ' . ts('Email'));
$this->setTitle(implode(',', $displayName) . ' - ' . ts('Email'));
}
else {
CRM_Utils_System::setTitle(ts('New Email'));
$this->setTitle(ts('New Email'));
}
if ($this->_context === 'search') {
$this->_single = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function buildQuickForm() {
* @param CRM_Core_Form $form
*/
public static function buildLabelForm($form) {
CRM_Utils_System::setTitle(ts('Make Mailing Labels'));
$form->setTitle(ts('Make Mailing Labels'));

//add select for label
$label = CRM_Core_BAO_LabelFormat::getList(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function postProcess() {
public static function createMapXML($ids, $locationId, &$page, $addBreadCrumb, $type = 'Contact') {
$config = CRM_Core_Config::singleton();

CRM_Utils_System::setTitle(ts('Map Location(s)'));
$this->setTitle(ts('Map Location(s)'));

This comment has been minimized.

Copy link
@eileenmcnaughton

eileenmcnaughton Nov 5, 2021

Contributor

Opps - this caused regression https://lab.civicrm.org/dev/core/-/issues/2942

$page->assign('query', 'CiviCRM Search Query');
$page->assign('mapProvider', $config->mapProvider);
$page->assign('mapKey', urlencode($config->mapAPIKey));
Expand Down
5 changes: 4 additions & 1 deletion CRM/Contact/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ public static function preProcessSingle(&$form, $cid) {
$form->_contactIds = explode(',', $cid);
// put contact display name in title for single contact mode
if (count($form->_contactIds) === 1) {
CRM_Utils_System::setTitle(ts('Print/Merge Document for %1', [1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')]));
$form->setTitle(
ts('Print/Merge Document for %1',
[1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')])
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/PickProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function preProcess() {
* Build the form object.
*/
public function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Update multiple contacts'));
$this->setTitle(ts('Update multiple contacts'));

foreach ($this->_contactIds as $id) {
$this->_contactTypes = CRM_Contact_BAO_Contact::getContactTypes($id);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/RemoveFromGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function buildQuickForm() {
$group = ['' => ts('- select group -')] + CRM_Core_PseudoConstant::nestedGroup();
$groupElement = $this->add('select', 'group_id', ts('Select Group'), $group, TRUE, ['class' => 'crm-select2 huge']);

CRM_Utils_System::setTitle(ts('Remove Contacts from Group'));
$this->setTitle(ts('Remove Contacts from Group'));
$this->addDefaultButtons(ts('Remove from Group'));
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Useradd.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function preProcess() {
$contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults, $ids);
$this->_displayName = $contact->display_name;
$this->_email = $contact->email;
CRM_Utils_System::setTitle(ts('Create User Record for %1', [1 => $this->_displayName]));
$this->setTitle(ts('Create User Record for %1', [1 => $this->_displayName]));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/AdditionalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function preProcess() {

if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
$title = $this->assignPaymentInfoBlock();
CRM_Utils_System::setTitle($title);
$this->setTitle($title);
return;
}
if ($this->_component == 'event') {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/CancelSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function preProcess() {
// handle context redirection
CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();

CRM_Utils_System::setTitle($this->_mid ? ts('Cancel Auto-renewal') : ts('Cancel Recurring Contribution'));
$this->setTitle($this->_mid ? ts('Cancel Auto-renewal') : ts('Cancel Recurring Contribution'));
$this->assign('mode', $this->_mode);

if ($this->isSelfService()) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public function preProcess() {
if ($this->_mode && $this->_id) {
$this->_payNow = TRUE;
$this->assign('payNow', $this->_payNow);
CRM_Utils_System::setTitle(ts('Pay with Credit Card'));
$this->setTitle(ts('Pay with Credit Card'));
}
elseif (!empty($this->_values['is_template'])) {
$this->setPageTitle(ts('Template Contribution'));
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Contribution/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function preProcess() {
$this->assign('thankyou_footer', CRM_Utils_Array::value('thankyou_footer', $this->_values));
$this->assign('max_reminders', CRM_Utils_Array::value('max_reminders', $this->_values));
$this->assign('initial_reminder_day', CRM_Utils_Array::value('initial_reminder_day', $this->_values));
CRM_Utils_System::setTitle(CRM_Utils_Array::value('thankyou_title', $this->_values));
$this->setTitle(CRM_Utils_Array::value('thankyou_title', $this->_values));
// Make the contributionPageID available to the template
$this->assign('contributionPageID', $this->_id);
$this->assign('isShare', $this->_values['is_share']);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/ContributionPage/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function setDefaultValues() {
$this->_id,
'title'
);
CRM_Utils_System::setTitle(ts('Title and Settings') . " ($title)");
$this->setTitle(ts('Title and Settings') . " ($title)");

foreach (['on_behalf', 'soft_credit'] as $module) {
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Form/ContributionView.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ public function preProcess() {
}

if (empty($values['is_template'])) {
CRM_Utils_System::setTitle(ts('View Contribution from') . ' ' . $displayName);
$this->setTitle(ts('View Contribution from') . ' ' . $displayName);
}
else {
CRM_Utils_System::setTitle(ts('View Template Contribution from') . ' ' . $displayName);
$this->setTitle(ts('View Template Contribution from') . ' ' . $displayName);
}

// add viewed contribution to recent items list
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Task/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function buildQuickForm() {
throw new CRM_Core_Exception('ufGroupId is missing');
}
$this->_title = ts('Update multiple contributions') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->setTitle($this->_title);

$this->addDefaultButtons(ts('Save'));
$this->_fields = [];
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Form/Task/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public function preProcess() {

CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
if ($this->_selectedOutput == 'email') {
CRM_Utils_System::setTitle(ts('Email Invoice'));
$this->setTitle(ts('Email Invoice'));
}
else {
CRM_Utils_System::setTitle(ts('Print Contribution Invoice'));
$this->setTitle(ts('Print Contribution Invoice'));
}
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Task/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function preProcess() {
// we have all the contribution ids, so now we get the contact ids
parent::setContactIDs();
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
$this->setTitle(ts('Print Contribution Receipts'));
// Ajax submit would interfere with pdf file download
$this->preventAjaxSubmit();
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/Task/PickProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function preProcess() {
$session = CRM_Core_Session::singleton();
$this->_userContext = $session->readUserContext();

CRM_Utils_System::setTitle(ts('Update multiple contributions'));
$this->setTitle(ts('Update multiple contributions'));

$validate = FALSE;
//validations
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/UpdateSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function preProcess() {
[$this->_donorDisplayName, $this->_donorEmail] = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}

CRM_Utils_System::setTitle(ts('Update Recurring Contribution'));
$this->setTitle(ts('Update Recurring Contribution'));

// Handle context redirection.
CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
Expand Down

0 comments on commit 7e2e255

Please sign in to comment.