You are here

public function WebformSubmissionValue::getElementCollection in Pardot Integration 2.x

Get the list of elements to map with.

Return value

array|mixed|null Just return the mapped field container.

1 call to WebformSubmissionValue::getElementCollection()
WebformSubmissionValue::buildConfigurationForm in src/Plugin/PardotFormMapFormatterPlugin/WebformSubmissionValue.php

File

src/Plugin/PardotFormMapFormatterPlugin/WebformSubmissionValue.php, line 185

Class

WebformSubmissionValue
Plugin to generate a text field and consume tokens for mappings.

Namespace

Drupal\pardot\Plugin\PardotFormMapFormatterPlugin

Code

public function getElementCollection() {
  $fields = [];
  $disallowed_types = $this->configuration['disallowed_field_types'] ?? [];
  $elements = $this
    ->getWebformElements();
  foreach ($elements as $id => $element) {
    if ($disallowed_types && !in_array($element['#type'], $disallowed_types)) {
      $fields[$id] = (string) $element['#title'];
    }
    elseif (!$disallowed_types) {
      $fields[$id] = (string) $element['#title'];
    }
  }
  $fields = [
    'none' => 'None',
  ] + $fields;
  return $fields;
}