Fix for CRM-15729
[civicrm-core.git] / CRM / Contact / Form / Edit / CommunicationPreferences.php
index 8fe1f5d15820c8502aa47cb3e72e003e5b7b5ac9..bcb691ae37badfbb3b4cf2d6f14c45d83fc3e9a0 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        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -41,24 +41,21 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
   /**
    * Greetings
    * @var array
-   * @static
    */
   static $greetings = array();
 
   /**
-   * Build the form object elements for Communication Preferences object
+   * Build the form object elements for Communication Preferences object.
    *
    * @param CRM_Core_Form $form
    *   Reference to the form object.
    *
    * @return void
-   * @static
    */
   public static function buildQuickForm(&$form) {
     // since the pcm - preferred comminication method is logically
     // grouped hence we'll use groups of HTML_QuickForm
 
-
     // checkboxes for DO NOT phone, email, mail
     // we take labels from SelectValues
     $privacy = $commPreff = $commPreference = array();
@@ -120,7 +117,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
       if (!empty($greetingTokens)) {
         $form->addElement('select', $fields['field'], $fields['label'],
           array(
-            '' => ts('- select -')
+            '' => ts('- select -'),
           ) + $greetingTokens
         );
         //custom addressee
@@ -132,7 +129,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
   }
 
   /**
-   * Global form rule
+   * Global form rule.
    *
    * @param array $fields
    *   The input form values.
@@ -142,7 +139,6 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
    *
    * @return bool|array
    *   true if no errors, else array of errors
-   * @static
    */
   public static function formRule($fields, $files, $self) {
     //CRM-4575
@@ -190,8 +186,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
     if ($form->_action & CRM_Core_Action::ADD) {
       foreach (CRM_Contact_BAO_Contact::$_greetingTypes as $greeting) {
         if (empty($defaults[$greeting . '_id'])) {
-          if ($defaultGreetingTypeId =
-            CRM_Contact_BAO_Contact_Utils::defaultGreeting($form->_contactType, $greeting)
+          if ($defaultGreetingTypeId = CRM_Contact_BAO_Contact_Utils::defaultGreeting($form->_contactType, $greeting)
           ) {
             $defaults[$greeting . '_id'] = $defaultGreetingTypeId;
           }
@@ -207,7 +202,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
   }
 
   /**
-   *  set array of greeting fields
+   *  set array of greeting fields.
    *
    * @param $contactType
    *
@@ -249,4 +244,5 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
 
     return self::$greetings[$contactType];
   }
+
 }