You are here

TokenInterface.php in Courier 8

Same filename and directory in other branches
  1. 2.x src/TokenInterface.php

Namespace

Drupal\courier

File

src/TokenInterface.php
View source
<?php

/**
 * @file
 * Contains \Drupal\courier\TokenInterface.
 */
namespace Drupal\courier;


/**
 * Interface for TokenTrait.
 *
 * Token values and options are stored for the session, they are not stored.
 */
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);

}

Interfaces

Namesort descending Description
TokenInterface Interface for TokenTrait.