Merge pull request #4983 from colemanw/CRM-15842
[civicrm-core.git] / CRM / Custom / Form / Group.php
index 30e7edef924f82762d51ab19ab53517694a69bbc..8f88a64ac70541e70fd09060704726290517bb3e 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -69,7 +69,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
   /**
    * Set variables up before form is built
    *
-   * @param null
    *
    * @return void
    */
@@ -116,7 +115,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    *
    * @return bool|array
    *   true if no errors, else array of errors
-   * @static
    */
   public static function formRule($fields, $files, $self) {
     $errors = array();
@@ -175,7 +173,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * add the rules (mainly global rules) for form.
    * All local rules are added near the element
    *
-   * @param null
    *
    * @return void
    * @see valid_date
@@ -187,7 +184,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
   /**
    * Build the form object
    *
-   * @param null
    *
    * @return void
    */
@@ -203,7 +199,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     $contactTypes = array('Contact', 'Individual', 'Household', 'Organization');
     $this->assign('contactTypes', json_encode($contactTypes));
 
-    $sel1 = array("" => "- select -") + CRM_Core_SelectValues::customGroupExtends();
+    $sel1 = array("" => ts("- select -")) + CRM_Core_SelectValues::customGroupExtends();
     $sel2 = array();
     $activityType = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
 
@@ -258,13 +254,13 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
         if ($main == 'Relationship') {
           $relName = self::getFormattedList($sel2[$main]);
           $sel2[$main] = array(
-              '' => ts("- Any -")
-            ) + $relName;
+            '' => ts("- Any -"),
+          ) + $relName;
         }
         else {
           $sel2[$main] = array(
-              '' => ts("- Any -")
-            ) + $sel2[$main];
+            '' => ts("- Any -"),
+          ) + $sel2[$main];
         }
       }
     }
@@ -277,8 +273,8 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
         $contactSubTypes[$key] = $key;
       }
       $sel2['Contact'] = array(
-          "" => "-- Any --"
-        ) + $contactSubTypes;
+        "" => ("- Any -"),
+      ) + $contactSubTypes;
     }
     else {
       if (!isset($this->_id)) {
@@ -391,11 +387,11 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       ),
     );
     if (!$this->_isGroupEmpty && !empty($this->_subtypes)) {
-      $buttons[0]['js'] = array('onclick' => "return warnDataLoss()");
+      $buttons[0]['class'] = 'crm-warnDataLoss';
     }
     $this->addButtons($buttons);
 
-    // views are implemented as frozen form
+    // TODO: Is this condition ever true? Can this code be removed?
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
       $this->addElement('button', 'done', ts('Done'), array('onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"));
@@ -406,7 +402,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    * Set default values for the form. Note that in edit/view mode
    * the default values are retrieved from the database
    *
-   * @param null
    *
    * @return array
    *   array of default values
@@ -458,7 +453,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
   /**
    * Process the form
    *
-   * @param null
    *
    * @return void
    */
@@ -533,7 +527,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    *   Array of relationship name.
    *
    * @return array
-   *   of relationship name.
+   *   Array of relationship name.
    */
   public static function getFormattedList(&$list) {
     $relName = array();
@@ -558,4 +552,5 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     }
     return $relName;
   }
+
 }