+ /**
+ * 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.
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+ protected function setSearchMetadata() {}
+
+ /**
+ * Handle force=1 in the url.
+ *
+ * Search field metadata is normally added in buildForm but we are bypassing that in this flow
+ * (I've always found the flow kinda confusing & perhaps that is the problem but this mitigates)
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+ protected function handleForcedSearch() {
+ $this->setSearchMetadata();
+ $this->addContactSearchFields();
+ $this->postProcess();
+ $this->set('force', 0);
+ }
+