Commit c83ca717 authored by jaapjansma's avatar jaapjansma

update on trying out form processor with loading defaults

parent 2277666c
......@@ -36,6 +36,7 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form {
public function buildQuickForm() {
$this->add('hidden', '_qf_formProcessorName');
$this->setDefaults(['_qf_formProcessorName' => $this->formProcessorName]);
$formProcessor = civicrm_api3('FormProcessorInstance', 'getsingle', ['name' => $this->formProcessorName]);
$defaultFields = civicrm_api3('FormProcessorDefaults', 'getfields', ['api_action' => $this->formProcessorName]);
$this->defaultFields = $defaultFields['values'];
$defaultFieldNames = [];
......@@ -56,6 +57,7 @@ class CRM_FormProcessor_Form_RunFormProcessor extends CRM_Core_Form {
}
$defaultFieldNames[] = $this->formProcessorName.'_default_'.$field['name'];
}
$this->assign('enableDefault', $formProcessor['enable_default_data']);
$this->assign('defaultFieldNames', $defaultFieldNames);
$fields = civicrm_api3('FormProcessor', 'getfields', ['api_action' => $this->formProcessorName]);
......
{crmScope extensionKey='form-processor'}
{if (count($defaultFieldNames))}
{if ($enableDefault)}
<div class="crm-form-block">
<div class="crm-accordion-wrapper crm-advanced_search_form-accordion">
<div class="crm-accordion-header crm-master-accordion-header">{ts}Retrieve default data{/ts}</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment