MappedEmailField.php in Pardot Integration 2.x
File
src/MappedEmailField.php
View source
<?php
namespace Drupal\pardot;
class MappedEmailField extends MappedFieldBase {
public function __construct(string $pardot_key = '', string $plugin_type = 'default_value', $plugin = [], $config = []) {
$this->pardotKey = $pardot_key;
$this->pluginType = $plugin_type;
if (!$plugin) {
$plugin = \Drupal::service('plugin.manager.pardot_form_map_formatter_plugin')
->createInstance($this->pluginType);
}
if ($plugin) {
$config += $plugin
->getConfiguration();
$config['allowed_field_types'] = [
'email',
];
$plugin
->setConfiguration($config);
}
$this->plugin = $plugin;
}
public function setPluginType(string $plugin_type) {
return $this;
}
}