X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm%2FMessageTemplates.php;h=b3dab487318b68f09a98ddafeb665ae8e429b112;hb=9f462279be2081a09d36b73d6bd1c2b5a2effd93;hp=d316d559e26873e28c897d02afb3655863b759ca;hpb=a215c544caa635c514906c3cbbebf086576d7032;p=civicrm-core.git diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index d316d559e2..b3dab48731 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ /** @@ -94,14 +94,14 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { // 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 { @@ -118,44 +118,43 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { $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); } if ($this->_action & CRM_Core_Action::DELETE) { + $this->assign('msg_title', $this->_values['msg_title']); 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(); @@ -187,12 +186,12 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { } else { $this->add('wysiwyg', 'msg_html', ts('HTML Message'), - array( + [ 'cols' => '80', 'rows' => '8', 'onkeyup' => "return verify(this)", 'preset' => 'civimail', - ) + ] ); } @@ -201,13 +200,13 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { ); $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(); @@ -308,7 +307,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { } $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