Merge pull request #11972 from eileenmcnaughton/sch
[civicrm-core.git] / CRM / Contact / Form / Search / Custom.php
index e82d7ad71f2ca0bbd36aac4311a79868a8ba1994..d6de166cdd94795dbca1b183f7f440eeab1fc92a 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
  */
 class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
 
@@ -83,6 +83,8 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
     // instantiate the new class
     $this->_customClass = new $this->_customSearchClass($this->_formValues);
 
+    $this->addFormRule(array($this->_customClass, 'formRule'), $this);
+
     // CRM-12747
     if (isset($this->_customClass->_permissionedComponent) &&
       !self::isPermissioned($this->_customClass->_permissionedComponent)
@@ -91,6 +93,13 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
     }
   }
 
+  /**
+   * Add local and global form rules.
+   */
+  public function addRules() {
+    $this->addFormRule(array($this->_customClass, 'formRule'));
+  }
+
   /**
    * Set the default values of various form elements.
    *