You are here

public static function wf_crm_admin_form::addPageBreak in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_admin_form.inc \wf_crm_admin_form::addPageBreak()

Create a page-break before the contribution-page field

Parameters

$field:

1 call to wf_crm_admin_form::addPageBreak()
wf_crm_admin_form::insertComponent in includes/wf_crm_admin_form.inc
Add a CiviCRM field to a webform

File

includes/wf_crm_admin_form.inc, line 1984
Webform CiviCRM module's admin form.

Class

wf_crm_admin_form
@file Webform CiviCRM module's admin form.

Code

public static function addPageBreak($field) {
  $node = node_load($field['nid']);

  // Check if it already exists
  foreach (wf_crm_aval($node->webform, 'components', array()) as $component) {
    if ($component['form_key'] == 'contribution_pagebreak') {
      return;
    }
  }
  $pagebreak = array(
    'nid' => $field['nid'],
    'form_key' => 'contribution_pagebreak',
    'type' => 'pagebreak',
    'name' => t('Payment'),
    'weight' => $field['weight'] - 9,
  );
  $pagebreak += webform_component_invoke('pagebreak', 'defaults');
  webform_component_insert($pagebreak);
}