Merge pull request #13068 from alifrumin/formLink
[civicrm-core.git] / CRM / Grant / Form / Search.php
index 6a63ab56a1d628f7d2031b525df5ad773c0cbb4b..5981f0d2134f380c3db1d8b7593117d5be5815be 100644 (file)
@@ -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
  */
 
 /**
@@ -62,7 +62,19 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = "grant_";
 
-  protected $entity = 'grant';
+  /**
+   * Metadata of all fields to include on the form.
+   *
+   * @var array
+   */
+  protected $searchFieldMetadata = [];
+
+  /**
+   * @return string
+   */
+  public function getDefaultEntity() {
+    return 'Grant';
+  }
 
   /**
    * Processing needed for buildForm and later.
@@ -77,7 +89,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
     $this->_actionButtonName = $this->getButtonName('next', 'action');
 
     $this->_done = FALSE;
-    $this->defaults = array();
 
     $this->loadStandardSearchOptionsFromUrl();
     $this->loadFormValues();
@@ -286,4 +297,13 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
     return ts('Find Grants');
   }
 
+  /**
+   * Get metadata for fields being assigned by metadata.
+   *
+   * @return array
+   */
+  protected function getEntityMetadata() {
+    return CRM_Grant_BAO_Query::getSearchFieldMetadata();
+  }
+
 }