Move retrieval of basicSearchFields to 'get' fn
authoreileen <emcnaughton@wikimedia.org>
Fri, 7 Jun 2019 02:41:43 +0000 (14:41 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 7 Jun 2019 03:38:58 +0000 (15:38 +1200)
This is a partial of https://github.com/civicrm/civicrm-core/pull/14418

CRM/Contact/Form/Search/Criteria.php

index 7ce75635f712741053f2f3503b8fe8ab63068d6e..240ade9aeaa664f6b40265c8f22cf69fffa51cea 100644 (file)
@@ -260,9 +260,16 @@ class CRM_Contact_Form_Search_Criteria {
    * @param CRM_Core_Form $form
    */
   protected static function setBasicSearchFields($form) {
-    $userFramework = CRM_Core_Config::singleton()->userFramework;
+    $form->assign('basicSearchFields', self::getBasicSearchFields());
+  }
 
-    $form->assign('basicSearchFields', [
+  /**
+   * Return list of basic contact fields that can be displayed for the basic search section.
+   *
+   */
+  public static function getBasicSearchFields() {
+    $userFramework = CRM_Core_Config::singleton()->userFramework;
+    return [
       'sort_name' => ['name' => 'sort_name'],
       'email' => ['name' => 'email'],
       'contact_type' => ['name' => 'contact_type'],
@@ -319,7 +326,7 @@ class CRM_Contact_Form_Search_Criteria {
         'name' => 'uf_user',
         'description' => ts('Does the contact have a %1 Account?', [$userFramework]),
       ],
-    ]);
+    ];
   }
 
   /**