Skip to content

Commit

Permalink
[NFC] array format tricksie file
Browse files Browse the repository at this point in the history
Change-Id: Ieb65feb2872af150ab576b1bfd3301b880df0caa
  • Loading branch information
eileenmcnaughton committed Apr 5, 2019
1 parent c2be63a commit 24be7e6
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions CRM/Admin/Form/MessageTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public function buildQuickForm() {
// currently, the above action is used solely for previewing default workflow templates
$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=workflow&reset=1');
$cancelURL = str_replace('&', '&', $cancelURL);
$this->addButtons(array(
array(
$this->addButtons([
[
'type' => 'cancel',
'name' => ts('Done'),
'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
'isDefault' => TRUE,
),
)
],
]
);
}
else {
Expand All @@ -118,23 +118,23 @@ public function buildQuickForm() {

$cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', "selectedChild={$selectedChild}&reset=1");
$cancelURL = str_replace('&', '&', $cancelURL);
$buttons[] = array(
$buttons[] = [
'type' => 'upload',
'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
'isDefault' => TRUE,
);
];
if (!($this->_action & CRM_Core_Action::DELETE)) {
$buttons[] = array(
$buttons[] = [
'type' => 'submit',
'name' => ts('Save and Done'),
'subName' => 'done',
);
];
}
$buttons[] = array(
$buttons[] = [
'type' => 'cancel',
'name' => ts('Cancel'),
'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
);
'js' => ['onclick' => "location.href='{$cancelURL}'; return false;"],
];
$this->addButtons($buttons);
}

Expand All @@ -143,20 +143,18 @@ public function buildQuickForm() {
return;
}

$breadCrumb = array(
array(
$breadCrumb = [
[
'title' => ts('Message Templates'),
'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates',
'action=browse&reset=1'
),
),
);
'url' => CRM_Utils_System::url('civicrm/admin/messageTemplates', 'action=browse&reset=1'),
],
];
CRM_Utils_System::appendBreadCrumb($breadCrumb);

$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'msg_title', ts('Message Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_MessageTemplate', 'msg_title'), TRUE);

$options = array(ts('Compose On-screen'), ts('Upload Document'));
$options = [ts('Compose On-screen'), ts('Upload Document')];
$element = $this->addRadio('file_type', ts('Source'), $options);
if ($this->_id) {
$element->freeze();
Expand Down Expand Up @@ -188,12 +186,12 @@ public function buildQuickForm() {
}
else {
$this->add('wysiwyg', 'msg_html', ts('HTML Message'),
array(
[
'cols' => '80',
'rows' => '8',
'onkeyup' => "return verify(this)",
'preset' => 'civimail',
)
]
);
}

Expand All @@ -202,13 +200,13 @@ public function buildQuickForm() {
);

$this->add('select', 'pdf_format_id', ts('PDF Page Format'),
array(
[
'null' => ts('- default -'),
) + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
] + CRM_Core_BAO_PdfFormat::getList(TRUE), FALSE
);

$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->addFormRule(array(__CLASS__, 'formRule'), $this);
$this->addFormRule([__CLASS__, 'formRule'], $this);

if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
Expand Down Expand Up @@ -309,7 +307,7 @@ public function postProcess() {
}

$messageTemplate = CRM_Core_BAO_MessageTemplate::add($params);
CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', array(1 => $messageTemplate->msg_title)), ts('Saved'), 'success');
CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', [1 => $messageTemplate->msg_title]), ts('Saved'), 'success');

if (isset($this->_submitValues['_qf_MessageTemplates_upload'])) {
// Save button was pressed
Expand Down

0 comments on commit 24be7e6

Please sign in to comment.