Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions modules/promotion/src/Entity/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down Expand Up @@ -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.'))
Expand Down
18 changes: 18 additions & 0 deletions modules/promotion/src/Entity/PromotionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down