class CommerceCondition in Commerce Core 8.2
Defines the condition plugin annotation object.
Plugin namespace: Plugin\Commerce\Condition.
Hierarchy
- class \Drupal\Component\Annotation\Plugin implements AnnotationInterface
- class \Drupal\commerce\Annotation\CommerceCondition uses StringTranslationTrait
Expanded class hierarchy of CommerceCondition
20 classes are annotated with CommerceCondition
- OrderBillingAddress in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderBillingAddress.php - Provides the billing address condition for orders.
- OrderCurrency in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCurrency.php - Provides the currency condition for orders.
- OrderCustomer in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCustomer.php - Provides the customer condition for orders.
- OrderCustomerRole in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderCustomerRole.php - Provides the customer role condition for orders.
- OrderEmail in modules/
order/ src/ Plugin/ Commerce/ Condition/ OrderEmail.php - Provides the Email address condition for orders.
File
- src/
Annotation/ CommerceCondition.php, line 15
Namespace
Drupal\commerce\AnnotationView source
class CommerceCondition extends Plugin {
use StringTranslationTrait;
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The condition label.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $label;
/**
* The condition display label.
*
* Shown in the condition UI when enabling/disabling a condition.
* Defaults to the main label.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $display_label;
/**
* The condition category.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
*/
public $category;
/**
* The condition entity type ID.
*
* This is the entity type ID of the entity passed to the plugin during
* evaluation. For example: 'commerce_order'.
*
* @var string
*/
public $entity_type;
/**
* The parent entity type ID.
*
* This is the entity type ID of the entity that embeds the conditions.
* For example: 'commerce_promotion'.
*
* When specified, a condition will only be available on that entity type.
*
* @var string
*/
public $parent_entity_type;
/**
* The condition weight.
*
* Used when sorting the condition list in the UI.
*
* @var int
*/
public $weight = 0;
/**
* Constructs a new CommerceCondition object.
*
* @param array $values
* The annotation values.
*/
public function __construct(array $values) {
if (empty($values['display_label'])) {
$values['display_label'] = $values['label'];
}
if (empty($values['category'])) {
$values['category'] = $this
->t('Other');
}
parent::__construct($values);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceCondition:: |
public | property | The condition category. | |
CommerceCondition:: |
public | property | The condition display label. | |
CommerceCondition:: |
public | property | The condition entity type ID. | |
CommerceCondition:: |
public | property | The plugin ID. | |
CommerceCondition:: |
public | property | The condition label. | |
CommerceCondition:: |
public | property | The parent entity type ID. | |
CommerceCondition:: |
public | property | The condition weight. | |
CommerceCondition:: |
public | function |
Constructs a new CommerceCondition object. Overrides Plugin:: |
|
Plugin:: |
protected | property | The plugin definition read from the class annotation. | 1 |
Plugin:: |
public | function |
Gets the value of an annotation. Overrides AnnotationInterface:: |
5 |
Plugin:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |