public function NumberPatternBase::generate in Commerce Core 8.2
Generates a number for the given content entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The content entity.
Return value
string The generated number.
Overrides NumberPatternInterface::generate
1 method overrides NumberPatternBase::generate()
- SequentialNumberPatternBase::generate in modules/
number_pattern/ src/ Plugin/ Commerce/ NumberPattern/ SequentialNumberPatternBase.php - Generates a number for the given content entity.
File
- modules/
number_pattern/ src/ Plugin/ Commerce/ NumberPattern/ NumberPatternBase.php, line 140
Class
- NumberPatternBase
- Provides a base class for number pattern plugins.
Namespace
Drupal\commerce_number_pattern\Plugin\Commerce\NumberPatternCode
public function generate(ContentEntityInterface $entity) {
$number = $this->token
->replace($this->configuration['pattern'], [
'pattern' => [],
$entity
->getEntityTypeId() => $entity,
]);
return $number;
}