You are here

function WebformCivicrmPreProcess::initialize in Webform CiviCRM Integration 8.5

Initialize form variables.

_state

Parameters

$form:

$handler:

Overrides WebformCivicrmPreProcessInterface::initialize

File

src/WebformCivicrmPreProcess.php, line 39
Front-end form pre-processor.

Class

WebformCivicrmPreProcess

Namespace

Drupal\webform_civicrm

Code

function initialize(&$form, FormStateInterface $form_state, WebformHandlerInterface $handler) {
  $utils = \Drupal::service('webform_civicrm.utils');
  $this->handler = $handler;
  $this->form =& $form;
  $this->form_state = $form_state;
  $this->node = $handler
    ->getWebform();
  $this->settings = $handler
    ->getConfiguration()['settings'];
  $this->data = $this->settings['data'];
  $this->ent['contact'] = [];
  $this->all_fields = $utils
    ->wf_crm_get_fields();
  $this->all_sets = $utils
    ->wf_crm_get_fields('sets');
  $this->enabled = $utils
    ->wf_crm_enabled_fields($handler
    ->getWebform());
  $this->line_items = $form_state
    ->get([
    'civicrm',
    'line_items',
  ]) ?: [];
  return $this;
}