You are here

interface VariantCollectionInterface in Chaos Tool Suite (ctools) 8.3

Provides an interface for objects that have variants e.g. Pages.

Hierarchy

Expanded class hierarchy of VariantCollectionInterface

All classes that implement VariantCollectionInterface

File

src/Plugin/VariantCollectionInterface.php, line 8

Namespace

Drupal\ctools\Plugin
View source
interface VariantCollectionInterface {

  /**
   * Adds a new variant to the entity.
   *
   * @param array $configuration
   *   An array of configuration for the new variant.
   *
   * @return string
   *   The variant ID.
   */
  public function addVariant(array $configuration);

  /**
   * Retrieves a specific variant.
   *
   * @param string $variant_id
   *   The variant ID.
   *
   * @return \Drupal\Core\Display\VariantInterface
   *   The variant object.
   */
  public function getVariant($variant_id);

  /**
   * Removes a specific variant.
   *
   * @param string $variant_id
   *   The variant ID.
   *
   * @return $this
   */
  public function removeVariant($variant_id);

  /**
   * Returns the variants available for the entity.
   *
   * @return \Drupal\Core\Display\VariantInterface[]
   *   An array of the variants.
   */
  public function getVariants();

}

Members

Namesort descending Modifiers Type Description Overrides
VariantCollectionInterface::addVariant public function Adds a new variant to the entity.
VariantCollectionInterface::getVariant public function Retrieves a specific variant.
VariantCollectionInterface::getVariants public function Returns the variants available for the entity.
VariantCollectionInterface::removeVariant public function Removes a specific variant.