You are here

interface BundleEntityDuplicatorInterface in Entity API 8

Duplicates bundle entities, their fields and displays.

Hierarchy

Expanded class hierarchy of BundleEntityDuplicatorInterface

All classes that implement BundleEntityDuplicatorInterface

1 file declares its use of BundleEntityDuplicatorInterface
EntityDuplicateSubscriber.php in src/EventSubscriber/EntityDuplicateSubscriber.php

File

src/BundleEntityDuplicatorInterface.php, line 10

Namespace

Drupal\entity
View source
interface BundleEntityDuplicatorInterface {

  /**
   * Duplicates the bundle entity, its fields and displays.
   *
   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $bundle_entity
   *   The bundle entity.
   * @param array $values
   *   An array of values to set, keyed by property name. Needs to at least
   *   contain a new ID.
   *
   * @return \Drupal\Core\Config\Entity\ConfigEntityInterface
   *   The new bundle entity, after it has been saved.
   *
   * @throws \InvalidArgumentException
   *   Thrown if the given entity is not a bundle entity, or if $values does
   *   not contain a new ID.
   */
  public function duplicate(ConfigEntityInterface $bundle_entity, array $values);

  /**
   * Duplicates the bundle entity's fields.
   *
   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $bundle_entity
   *   The bundle entity.
   * @param string $target_bundle_id
   *   The target bundle ID.
   *
   * @throws \InvalidArgumentException
   *   Thrown if the given entity is not a bundle entity.
   */
  public function duplicateFields(ConfigEntityInterface $bundle_entity, $target_bundle_id);

  /**
   * Duplicates the bundle entity's view/form displays.
   *
   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $bundle_entity
   *   The bundle entity.
   * @param string $target_bundle_id
   *   The target bundle ID.
   *
   * @throws \InvalidArgumentException
   *   Thrown if the given entity is not a bundle entity.
   */
  public function duplicateDisplays(ConfigEntityInterface $bundle_entity, $target_bundle_id);

}

Members

Namesort descending Modifiers Type Description Overrides
BundleEntityDuplicatorInterface::duplicate public function Duplicates the bundle entity, its fields and displays. 1
BundleEntityDuplicatorInterface::duplicateDisplays public function Duplicates the bundle entity's view/form displays. 1
BundleEntityDuplicatorInterface::duplicateFields public function Duplicates the bundle entity's fields. 1