Merge pull request #15790 from civicrm/5.20
[civicrm-core.git] / CRM / Core / Form / Search.php
index 4e19ee206d184bf738fabd2324cce2ce0d9bee85..c4ea8a259940579fc321911d818dbf5880350c05 100644 (file)
@@ -519,6 +519,22 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
     return (array) $this->get('formValues');
   }
 
+  /**
+   * Get the string processed to determine sort order.
+   *
+   * This looks like 'sort_name_u' for Sort name ascending.
+   *
+   * @return string|null
+   */
+  protected function getSortID() {
+    if ($this->get(CRM_Utils_Sort::SORT_ID)) {
+      return CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID),
+        $this->get(CRM_Utils_Sort::SORT_DIRECTION)
+      );
+    }
+    return NULL;
+  }
+
   /**
    * Set the metadata for the form.
    *