You are here

interface TemplateInterface in Wysiwyg API template plugin 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/wysiwyg_template_core/src/TemplateInterface.php \Drupal\wysiwyg_template_core\TemplateInterface

Provides an interface for defining Template entities.

Hierarchy

Expanded class hierarchy of TemplateInterface

All classes that implement TemplateInterface

1 file declares its use of TemplateInterface
Template.php in src/Entity/Template.php

File

modules/wysiwyg_template_core/src/TemplateInterface.php, line 11

Namespace

Drupal\wysiwyg_template_core
View source
interface TemplateInterface {

  /**
   * Gets the template description.
   *
   * @return string
   *   The template description.
   */
  public function getDescription() : string;

  /**
   * Gets the template body.
   *
   * @return string
   *   The template HTML body.
   */
  public function getBody() : string;

  /**
   * Gets the text format.
   *
   * @return string
   *   The text format for the body.
   */
  public function getFormat() : string;

  /**
   * Gets the template weight.
   *
   * @return int
   *   The template weight.
   */
  public function getWeight() : int;

  /**
   * Gets the list of allowed node types.
   *
   * @return string[]
   */
  public function getNodeTypes() : array;

  /**
   * Gets the list of allowed types for the given entity type.
   *
   * @param string|null $entity_type
   *
   * @return string[]
   */
  public function getBundles($entity_type = NULL) : array;

  /**
   * @param string $entity_type
   * @param array $bundles
   *
   * @return \Drupal\wysiwyg_template_core\TemplateInterface
   */
  public function setBundles($entity_type, array $bundles) : TemplateInterface;

  /**
   * Loads templates filtered by node type.
   *
   * @param \Drupal\node\NodeTypeInterface $node_type
   *   (optional) The node type to filter by. If this is not passed, only
   *   templates that specify *no* types will be returned.
   *
   * @return \Drupal\wysiwyg_template_core\TemplateInterface[]
   *   The list of available templates filtered by node type.
   */
  public static function loadByNodeType(NodeTypeInterface $node_type = NULL) : array;

  /**
   * Loads templates filtered by entity type and bundle.
   *
   * @param string $entity_type
   *   (optional) The entity type to filter by. If this is not passed, only
   *   templates that specify *no* types will be returned.
   * @param string $bundle
   *   (optional) The bundle for the given entity type to filter by.
   *
   * @return \Drupal\wysiwyg_template_core\TemplateInterface[]
   *   The list of available templates filtered by entity type.
   */
  public static function loadByTypeAndBundle($entity_type, $bundle) : array;

}

Members

Namesort descending Modifiers Type Description Overrides
TemplateInterface::getBody public function Gets the template body. 1
TemplateInterface::getBundles public function Gets the list of allowed types for the given entity type. 1
TemplateInterface::getDescription public function Gets the template description. 1
TemplateInterface::getFormat public function Gets the text format. 1
TemplateInterface::getNodeTypes public function Gets the list of allowed node types. 1
TemplateInterface::getWeight public function Gets the template weight. 1
TemplateInterface::loadByNodeType public static function Loads templates filtered by node type. 1
TemplateInterface::loadByTypeAndBundle public static function Loads templates filtered by entity type and bundle. 1
TemplateInterface::setBundles public function 1