You are here

interface SchemaMetatagTestTagInterface in Schema.org Metatag 8

Same name and namespace in other branches
  1. 8.2 src/SchemaMetatagTestTagInterface.php \Drupal\schema_metatag\SchemaMetatagTestTagInterface

Interface SchemaMetatagTestTagInterface.

Methods that provide test values for SchemaNameBase and its derivatives.

@package Drupal\schema_metatag

Hierarchy

Expanded class hierarchy of SchemaMetatagTestTagInterface

All classes that implement SchemaMetatagTestTagInterface

1 file declares its use of SchemaMetatagTestTagInterface
SchemaNameBase.php in src/Plugin/metatag/Tag/SchemaNameBase.php

File

src/SchemaMetatagTestTagInterface.php, line 12

Namespace

Drupal\schema_metatag
View source
interface SchemaMetatagTestTagInterface {

  /**
   * Provide a test input value for the property that will validate.
   *
   * Tags like @type that contain values other than simple strings, for
   * instance a list of allowed options, should extend this method and return
   * a valid value.
   *
   * Value must be static so the test can retrieve the value without
   * instantiating the class.
   *
   * @return mixed
   *   Return the test value, either a string or array, depending on the
   *   property.
   */
  public static function testValue();

  /**
   * Provide a test output value for the input value.
   *
   * Tags that return values in a different format than the input, like
   * values that are exploded, should extend this method and return
   * a valid value.
   *
   * Value must be static so the test can retrieve the value without
   * instantiating the class.
   *
   * @param mixed $items
   *   The input value, either a string or an array.
   *
   * @return mixed
   *   Return the correct output value.
   */
  public static function processedTestValue($items);

  /**
   * Transform input value to its display output.
   *
   * Tags that need to transform the output to something different than the
   * stored value should extend this method and do the transformation here.
   *
   * @param mixed $input_value
   *   Input value, could be either a string or array. This will be the
   *   unserialized value stored in the tag configuration, after token
   *   replacement.
   *
   * @return mixed
   *   Return the (possibly expanded) value which will be rendered in JSON-LD.
   */
  public static function outputValue($input_value);

  /**
   * Explode a test value.
   *
   * For test values, emulates the extra processing a multiple value would get.
   *
   * Value must be static so the test can retrieve the value without
   * instantiating the class.
   *
   * @param mixed $items
   *   The input value, either a string or an array.
   *
   * @return mixed
   *   Return the correct output value.
   */
  public static function processTestExplodeValue($items);

  /**
   * Provide a random test value.
   *
   * A helper function to create a random test value. Use the delimiter to
   * create comma-separated values, or a few "words" separated by spaces.
   *
   * Value must be static so the test can retrieve the value without
   * instantiating the class.
   *
   * @param int $count
   *   Number of "words".
   * @param int $delimiter
   *   Delimiter used to connect "words".
   *
   * @return mixed
   *   Return the test value, either a string or array, depending on the
   *   property.
   */
  public static function testDefaultValue($count = NULL, $delimiter = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
SchemaMetatagTestTagInterface::outputValue public static function Transform input value to its display output. 1
SchemaMetatagTestTagInterface::processedTestValue public static function Provide a test output value for the input value. 1
SchemaMetatagTestTagInterface::processTestExplodeValue public static function Explode a test value. 1
SchemaMetatagTestTagInterface::testDefaultValue public static function Provide a random test value. 1
SchemaMetatagTestTagInterface::testValue public static function Provide a test input value for the property that will validate. 1