You are here

interface TextimageInterface in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 src/TextimageInterface.php \Drupal\textimage\TextimageInterface

Provides an interface for Textimage objects.

Hierarchy

Expanded class hierarchy of TextimageInterface

All classes that implement TextimageInterface

File

src/TextimageInterface.php, line 13

Namespace

Drupal\textimage
View source
interface TextimageInterface extends ContainerInjectionInterface {

  /**
   * Set the image style.
   *
   * @param \Drupal\image\ImageStyleInterface $image_style
   *   The image style to be used to derive the Textimage.
   *
   * @return $this
   */
  public function setStyle(ImageStyleInterface $image_style);

  /**
   * Set the image effects.
   *
   * @param array $effects
   *   An array of image effects. Since Textimage manipulates effects before
   *   rendering the image, the style effects are copied here to allow that.
   *
   * @return $this
   */
  public function setEffects(array $effects);

  /**
   * Sets the image file extension.
   *
   * @param string $extension
   *   The file extension to be used (e.g. jpeg/png/gif).
   *
   * @return $this
   */
  public function setTargetExtension($extension);

  /**
   * Set the RGB hex color to be used for GIF images.
   *
   * @param string $color
   *   The color to be used for transparent.
   *
   * @return $this
   */
  public function setGifTransparentColor($color);

  /**
   * Sets the image source file.
   *
   * @param \Drupal\file\FileInterface $source_image_file
   *   A file entity.
   * @param int|null $width
   *   (optional) The source image width if known. Defaults to NULL.
   * @param int|null $height
   *   (optional) The source image height if known. Defaults to NULL.
   *
   * @return $this
   */
  public function setSourceImageFile(FileInterface $source_image_file, $width = NULL, $height = NULL);

  /**
   * Sets the token data to resolve tokens.
   *
   * @param array $token_data
   *   An array of objects to resolve tokens.
   *
   * @return $this
   */
  public function setTokenData(array $token_data);

  /**
   * Set Textimage to be temporary.
   *
   * @param bool $is_temp
   *   FALSE if caching is required for this Textimage.
   *
   * @return $this
   */
  public function setTemporary($is_temp);

  /**
   * Set image destination URI.
   *
   * @param string $uri
   *   A valid URI.
   *
   * @return $this
   */
  public function setTargetUri($uri);

  /**
   * Sets the bubbleable metadata.
   *
   * @param \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata
   *   A BubbleableMetadata object.
   *
   * @return $this
   *
   * @internal
   */
  public function setBubbleableMetadata(BubbleableMetadata $bubbleable_metadata = NULL);

  /**
   * Return the Textimage id.
   *
   * @return string
   *   A SHA256 hash.
   */
  public function id();

  /**
   * Return the processed text.
   *
   * @return array
   *   An array of fully processed text elements.
   */
  public function getText();

  /**
   * Returns the URI of the Textimage.
   *
   * @return string
   *   An URI.
   */
  public function getUri();

  /**
   * Returns the URL of the Textimage.
   *
   * @return \Drupal\Core\Url
   *   The Url object for the textimage.
   */
  public function getUrl();

  /**
   * Returns the height of the Textimage.
   *
   * @return int|null
   *   The height of the Textimage, or NULL if not available.
   */
  public function getHeight();

  /**
   * Returns the width of the Textimage.
   *
   * @return int|null
   *   The width of the Textimage, or NULL if not available.
   */
  public function getWidth();

  /**
   * Gets the bubbleable metadata of the Textimage.
   *
   * @return \Drupal\Core\Render\BubbleableMetadata
   *   A BubbleableMetadata object.
   */
  public function getBubbleableMetadata();

  /**
   * Load Textimage metadata from cache.
   *
   * @param string $id
   *   The id of the Textimage to load.
   *
   * @return bool
   *   TRUE if cache entry exists, FALSE otherwise.
   */
  public function load($id);

  /**
   * Process the Textimage, with the required raw text.
   *
   * @param array|string $text
   *   An array of text strings, or a single string, with tokens not resolved.
   *
   * @return $this
   */
  public function process($text);

  /**
   * Build the image via core ImageStyle::createDerivative() method.
   *
   * @return $this
   */
  public function buildImage();

}

Members

Namesort descending Modifiers Type Description Overrides
ContainerInjectionInterface::create public static function Instantiates a new instance of this class. 70
TextimageInterface::buildImage public function Build the image via core ImageStyle::createDerivative() method. 1
TextimageInterface::getBubbleableMetadata public function Gets the bubbleable metadata of the Textimage. 1
TextimageInterface::getHeight public function Returns the height of the Textimage. 1
TextimageInterface::getText public function Return the processed text. 1
TextimageInterface::getUri public function Returns the URI of the Textimage. 1
TextimageInterface::getUrl public function Returns the URL of the Textimage. 1
TextimageInterface::getWidth public function Returns the width of the Textimage. 1
TextimageInterface::id public function Return the Textimage id. 1
TextimageInterface::load public function Load Textimage metadata from cache. 1
TextimageInterface::process public function Process the Textimage, with the required raw text. 1
TextimageInterface::setBubbleableMetadata public function Sets the bubbleable metadata. 1
TextimageInterface::setEffects public function Set the image effects. 1
TextimageInterface::setGifTransparentColor public function Set the RGB hex color to be used for GIF images. 1
TextimageInterface::setSourceImageFile public function Sets the image source file. 1
TextimageInterface::setStyle public function Set the image style. 1
TextimageInterface::setTargetExtension public function Sets the image file extension. 1
TextimageInterface::setTargetUri public function Set image destination URI. 1
TextimageInterface::setTemporary public function Set Textimage to be temporary. 1
TextimageInterface::setTokenData public function Sets the token data to resolve tokens. 1