You are here

interface TokenInterface in Courier 8

Same name and namespace in other branches
  1. 2.x src/TokenInterface.php \Drupal\courier\TokenInterface

Interface for TokenTrait.

Token values and options are stored for the session, they are not stored.

Hierarchy

Expanded class hierarchy of TokenInterface

All classes that implement TokenInterface

File

src/TokenInterface.php, line 15
Contains \Drupal\courier\TokenInterface.

Namespace

Drupal\courier
View source
interface TokenInterface {

  /**
   * Gets token values.
   *
   * @return array
   *   Token values keyed by token type.
   */
  function getTokenValues();

  /**
   * Sets a value to a token type.
   *
   * @param string $token
   *   A token type.
   * @param mixed $value
   *   The token value.
   *
   * @return self
   *   Return this instance for chaining.
   */
  function setTokenValue($token, $value);

  /**
   * Gets token options as required by \Drupal::token()->replace().
   *
   * @return array
   *   An array of token options.
   */
  function getTokenOptions();

  /**
   * Sets a token option.
   *
   * @param string $option
   *   The token option name.
   * @param mixed $value
   *   The token option value.
   *
   * @return self
   *   Return this instance for chaining.
   */
  function setTokenOption($option, $value);

}

Members

Namesort descending Modifiers Type Description Overrides
TokenInterface::getTokenOptions function Gets token options as required by \Drupal::token()->replace().
TokenInterface::getTokenValues function Gets token values.
TokenInterface::setTokenOption function Sets a token option.
TokenInterface::setTokenValue function Sets a value to a token type.