You are here

interface EntityTraitManagerInterface in Commerce Core 8.2

Defines the interface for commerce_entity_trait plugin managers.

Hierarchy

Expanded class hierarchy of EntityTraitManagerInterface

All classes that implement EntityTraitManagerInterface

4 files declare their use of EntityTraitManagerInterface
CommerceBundleEntityFormBase.php in src/Form/CommerceBundleEntityFormBase.php
OrderTypeForm.php in modules/order/src/Form/OrderTypeForm.php
ProductTypeForm.php in modules/product/src/Form/ProductTypeForm.php
ProductVariationTypeForm.php in modules/product/src/Form/ProductVariationTypeForm.php

File

src/EntityTraitManagerInterface.php, line 11

Namespace

Drupal\commerce
View source
interface EntityTraitManagerInterface extends PluginManagerInterface {

  /**
   * Gets the definitions filtered by entity type.
   *
   * @param string $entity_type_id
   *   The entity type id.
   *
   * @return array
   *   The definitions.
   */
  public function getDefinitionsByEntityType($entity_type_id);

  /**
   * Detects conflicts between the given trait and the installed traits.
   *
   * A conflict exists if the given trait has a field with a name that's already
   * taken by a field from an installed trait.
   *
   * @param \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface $trait
   *   The trait.
   * @param \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface[] $installed_traits
   *   The installed traits.
   */
  public function detectConflicts(EntityTraitInterface $trait, array $installed_traits);

  /**
   * Installs the given trait for the given entity type and bundle.
   *
   * Installing a trait attaches any fields that the trait provides to the
   * given bundle.
   *
   * @param \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface $trait
   *   The trait.
   * @param string $entity_type_id
   *   The entity type id.
   * @param string $bundle
   *   The bundle.
   */
  public function installTrait(EntityTraitInterface $trait, $entity_type_id, $bundle);

  /**
   * Checks whether the given trait can be uninstalled.
   *
   * A trait can only be uninstalled if the fields it provides contain no data.
   *
   * @param \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface $trait
   *   The trait.
   * @param string $entity_type_id
   *   The entity type id.
   * @param string $bundle
   *   The bundle.
   */
  public function canUninstallTrait(EntityTraitInterface $trait, $entity_type_id, $bundle);

  /**
   * Uninstalls the given trait for the given entity type and bundle.
   *
   * Uninstalling a trait removes any fields that the trait provides from the
   * given bundle.
   *
   * @param \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface $trait
   *   The trait.
   * @param string $entity_type_id
   *   The entity type id.
   * @param string $bundle
   *   The bundle.
   */
  public function uninstallTrait(EntityTraitInterface $trait, $entity_type_id, $bundle);

}

Members

Namesort descending Modifiers Type Description Overrides
DiscoveryInterface::getDefinition public function Gets a specific plugin definition. 4
DiscoveryInterface::getDefinitions public function Gets the definition of all plugins for this type. 3
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists. 2
EntityTraitManagerInterface::canUninstallTrait public function Checks whether the given trait can be uninstalled. 1
EntityTraitManagerInterface::detectConflicts public function Detects conflicts between the given trait and the installed traits. 1
EntityTraitManagerInterface::getDefinitionsByEntityType public function Gets the definitions filtered by entity type. 1
EntityTraitManagerInterface::installTrait public function Installs the given trait for the given entity type and bundle. 1
EntityTraitManagerInterface::uninstallTrait public function Uninstalls the given trait for the given entity type and bundle. 1
FactoryInterface::createInstance public function Creates a pre-configured instance of a plugin. 7
MapperInterface::getInstance public function Gets a preconfigured instance of a plugin. 4