WebformMapping.php in Pardot Integration 2.x
File
src/Plugin/FormMapHandlerPlugin/WebformMapping.php
View source
<?php
namespace Drupal\pardot\Plugin\FormMapHandlerPlugin;
use Drupal\Core\Form\FormStateInterface;
use Drupal\pardot\FormMap;
use Drupal\pardot\Plugin\FormMapHandlerPluginBase;
class WebformMapping extends FormMapHandlerPluginBase {
public function getPluginId() {
return 'webform_mapping';
}
public function defaultConfiguration() {
return [
'entity_types' => [],
'entity_type_id' => 'webform',
'entity_id' => '',
] + parent::defaultConfiguration();
}
public function getPluginDefinition() {
return $this->pluginDefinition;
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
}
public function injectRequiredFields(FormMap $pardot_form_map) {
$pardot_form_map
->appendMappedField('\\Drupal\\pardot\\MappedEmailField', 'email', 'webform_submission_value', [], [
'entity_id' => $this->configuration['entity_type_id'] . ':' . $this->configuration['entity_id'],
]);
}
}
Classes
Name |
Description |
WebformMapping |
Plugin to capture browser cookies and send them to pardot. |