diff --git a/modules/promotion/src/Entity/Promotion.php b/modules/promotion/src/Entity/Promotion.php index 2756dc9ccb..861cb76884 100644 --- a/modules/promotion/src/Entity/Promotion.php +++ b/modules/promotion/src/Entity/Promotion.php @@ -75,6 +75,21 @@ public function setName($name) { return $this; } + /** + * {@inheritdoc} + */ + public function getDescription() { + return $this->get('description')->value; + } + + /** + * {@inheritdoc} + */ + public function setDescription($description) { + $this->set('description', $description); + return $this; + } + /** * {@inheritdoc} */ @@ -240,6 +255,21 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('form', TRUE); + $fields['description'] = BaseFieldDefinition::create('string_long') + ->setLabel(t('Description')) + ->setDescription(t('Additional information about the promotion to show to the customer')) + ->setTranslatable(TRUE) + ->setDefaultValue('') + ->setDisplayOptions('form', [ + 'type' => 'string_textarea', + 'weight' => 1, + 'settings' => [ + 'rows' => 3, + ], + ]) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayConfigurable('form', TRUE); + $fields['order_types'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Order types')) ->setDescription(t('The order types for which the promotion is valid.')) diff --git a/modules/promotion/src/Entity/PromotionInterface.php b/modules/promotion/src/Entity/PromotionInterface.php index 103185a951..d662b08340 100644 --- a/modules/promotion/src/Entity/PromotionInterface.php +++ b/modules/promotion/src/Entity/PromotionInterface.php @@ -28,6 +28,24 @@ public function getName(); */ public function setName($name); + /** + * Gets the promotion description. + * + * @return string + * The promotion description. + */ + public function getDescription(); + + /** + * Sets the promotion description. + * + * @param string $description + * The promotion description. + * + * @return $this + */ + public function setDescription($description); + /** * Gets the promotion order types. *