public function wf_crm_admin_component::adjustPageBreak in Webform CiviCRM Integration 7.5
Same name and namespace in other branches
- 7.4 includes/wf_crm_admin_component.inc \wf_crm_admin_component::adjustPageBreak()
Ensure page breaks are not placed after contribution page
File
- includes/
wf_crm_admin_component.inc, line 202
Class
Code
public function adjustPageBreak() {
$components = $this->node->webform['components'];
foreach ($components as $cid => $component) {
if ($component['form_key'] == 'civicrm_1_contribution_1_contribution_contribution_page_id') {
// Iterate up through parents
while ($component['pid']) {
$component = $components[$component['pid']];
}
$min = $component['weight'];
}
}
if (isset($min)) {
$weight = $this->form['position']['weight']['#default_value'];
$this->form['position']['weight'] = [
'#type' => 'value',
];
if ($weight >= $min) {
$weight = $min - 1;
}
$this->form['position']['weight']['#value'] = $weight;
}
}