interface EntityTraitInterface in Commerce Core 8.2
Defines the interface for entity traits.
An entity trait represents a behavior that can be attached to a specific entity bundle, by acting as a marker ("product is shippable") and/or providing a set of fields.
Hierarchy
- interface \Drupal\Component\Plugin\PluginInspectionInterface
- interface \Drupal\commerce\Plugin\Commerce\EntityTrait\EntityTraitInterface
Expanded class hierarchy of EntityTraitInterface
All classes that implement EntityTraitInterface
2 files declare their use of EntityTraitInterface
File
- src/
Plugin/ Commerce/ EntityTrait/ EntityTraitInterface.php, line 14
Namespace
Drupal\commerce\Plugin\Commerce\EntityTraitView source
interface EntityTraitInterface extends PluginInspectionInterface {
/**
* Gets the entity trait label.
*
* @return string
* The entity trait label.
*/
public function getLabel();
/**
* Gets the entity type IDs.
*
* These are the entity types that can have this trait.
* If empty, defaults to all entity types.
*
* @return string[]
* The entity type IDs.
*/
public function getEntityTypeIds();
/**
* Builds the field definitions.
*
* THe provided field definitions will be created as configurable
* fields when the entity trait is installed for an entity type/bundle.
*
* @return \Drupal\entity\BundleFieldDefinition[]
* An array of field definitions, keyed by field name.
*/
public function buildFieldDefinitions();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityTraitInterface:: |
public | function | Builds the field definitions. | 1 |
EntityTraitInterface:: |
public | function | Gets the entity type IDs. | 1 |
EntityTraitInterface:: |
public | function | Gets the entity trait label. | 1 |
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |