}
if ($this->_force) {
- // 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)
- $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]);
- $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]);
- $this->postProcess();
- $this->set('force', 0);
+ $this->handleForcedSearch();
}
$sortID = NULL;
return ts('Find Contributions');
}
+ /**
+ * Set the metadata for the form.
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+ protected function setSearchMetadata() {
+ $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]);
+ $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]);
+ }
+
}
return (array) $this->get('formValues');
}
+ /**
+ * 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->postProcess();
+ $this->set('force', 0);
+ }
+
}