You are here

class MappedEmailField in Pardot Integration 2.x

Provides a class for mapped fields.

Hierarchy

Expanded class hierarchy of MappedEmailField

1 file declares its use of MappedEmailField
pardot.module in ./pardot.module
Contains pardot.module.

File

src/MappedEmailField.php, line 8

Namespace

Drupal\pardot
View source
class MappedEmailField extends MappedFieldBase {

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  public function setPluginType(string $plugin_type) {

    // We don't want this to change.
    // $this->pluginType = $plugin_type.
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MappedEmailField::setPluginType public function Set the machine name of the plugin_type chosen. Overrides MappedFieldBase::setPluginType
MappedEmailField::__construct public function Constructs a new MappedField. Overrides MappedFieldBase::__construct
MappedFieldBase::$pardotKey protected property The pardot field key to map the value to.
MappedFieldBase::$plugin protected property The Plugin associated with this map.
MappedFieldBase::$pluginType protected property The plguin Type.
MappedFieldBase::getPardotKey public function Get the pardot key string. Overrides MappedFieldInterface::getPardotKey
MappedFieldBase::getPlugin public function Return the plugin instance or null. Overrides MappedFieldInterface::getPlugin
MappedFieldBase::getPluginType public function Get the machine name of the option chosen for the plugin type. Overrides MappedFieldInterface::getPluginType
MappedFieldBase::setPardotKey public function Set the string for the pardot key. Overrides MappedFieldInterface::setPardotKey
MappedFieldBase::setPlugin public function Set the instance of the plugin for this MappedField. Overrides MappedFieldInterface::setPlugin
MappedFieldBase::toArray public function Returns an array representation of the segment. Overrides MappedFieldInterface::toArray