Merge pull request #15764 from civicrm/5.20
[civicrm-core.git] / CRM / Contact / Form / GroupContact.php
index 0a628244af893b5b62c7a4346c8d712edc4f57bb..94ee2c4ff7bf819049634ba59f129ef65ce81bda 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
+ | Copyright CiviCRM LLC (c) 2004-2020                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
  */
 
 /**
@@ -83,7 +83,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
       $ids = CRM_Core_PseudoConstant::allGroup();
       $heirGroups = CRM_Contact_BAO_Group::getGroupsHierarchy($ids);
 
-      $allGroups = array();
+      $allGroups = [];
       foreach ($heirGroups as $id => $group) {
         // make sure that this group has public visibility
         if ($onlyPublicGroups && $group['visibility'] == 'User and User Admin Only') {
@@ -111,7 +111,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
       $groupSelect = $groupHierarchy;
     }
 
-    $groupSelect = array('' => ts('- select group -')) + $groupSelect;
+    $groupSelect = ['' => ts('- select group -')] + $groupSelect;
 
     if (count($groupSelect) > 1) {
       $session = CRM_Core_Session::singleton();
@@ -123,16 +123,15 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
         $msg = ts('Add to a group');
       }
 
-      $this->addField('group_id', array('class' => 'crm-action-menu fa-plus', 'placeholder' => $msg, 'options' => $groupSelect));
+      $this->addField('group_id', ['class' => 'crm-action-menu fa-plus', 'placeholder' => $msg, 'options' => $groupSelect]);
 
-      $this->addButtons(array(
-          array(
-            'type' => 'next',
-            'name' => ts('Add'),
-            'isDefault' => TRUE,
-          ),
-        )
-      );
+      $this->addButtons([
+        [
+          'type' => 'next',
+          'name' => ts('Add'),
+          'isDefault' => TRUE,
+        ],
+      ]);
     }
   }
 
@@ -140,7 +139,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
    * Post process form.
    */
   public function postProcess() {
-    $contactID = array($this->_contactId);
+    $contactID = [$this->_contactId];
     $groupId = $this->controller->exportValue('GroupContact', 'group_id');
     $method = ($this->_context == 'user') ? 'Web' : 'Admin';
 
@@ -154,7 +153,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
 
     if ($groupContact && $this->_context != 'user') {
       $groups = CRM_Core_PseudoConstant::group();
-      CRM_Core_Session::setStatus(ts("Contact has been added to '%1'.", array(1 => $groups[$groupId])), ts('Added to Group'), 'success');
+      CRM_Core_Session::setStatus(ts("Contact has been added to '%1'.", [1 => $groups[$groupId]]), ts('Added to Group'), 'success');
     }
   }