You are here

MappedFieldBase.php in Pardot Integration 2.x

Namespace

Drupal\pardot

File

src/MappedFieldBase.php
View source
<?php

namespace Drupal\pardot;


/**
 * Provides a class for mapped fields.
 */
abstract class MappedFieldBase implements MappedFieldInterface {

  /**
   * The pardot field key to map the value to.
   *
   * @var string
   */
  protected $pardotKey;

  /**
   * The plguin Type.
   *
   * @var string
   */
  protected $pluginType;

  /**
   * The Plugin associated with this map.
   *
   * @var mixed
   */
  protected $plugin;

  /**
   * {@inheritdoc}
   */
  public function __construct(string $pardot_key = '', $plugin_type = '', $plugin = [], $config = []) {
    $this->pardotKey = $pardot_key;
    $this->pluginType = $plugin_type;
    $this->plugin = $plugin;
  }

  /**
   * {@inheritdoc}
   */
  public function getPardotKey() {
    return $this->pardotKey;
  }

  /**
   * {@inheritdoc}
   */
  public function setPardotKey($pardot_key) {
    $this->pardotKey = $pardot_key;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginType() {
    return $this->pluginType;
  }

  /**
   * {@inheritdoc}
   */
  public function setPluginType(string $plugin_type) {
    $this->pluginType = $plugin_type;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getPlugin() {
    return $this->plugin;
  }

  /**
   * {@inheritdoc}
   */
  public function setPlugin($plugin) {
    $this->plugin = $plugin;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function toArray() {
    return [
      'pardot_key' => $this
        ->getPardotKey(),
      'plugin_type' => $this
        ->getPluginType(),
      'plugin' => $this
        ->getPlugin(),
      'class' => get_called_class(),
    ];
  }

}

Classes

Namesort descending Description
MappedFieldBase Provides a class for mapped fields.