use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\workflows\Plugin\WorkflowTypeBase;
-use Drupal\workflows\WorkflowInterface;
/**
* Test workflow type.
use StringTranslationTrait;
- /**
- * {@inheritdoc}
- */
- public function initializeWorkflow(WorkflowInterface $workflow) {
- $workflow
- ->addState('fresh', $this->t('Fresh'))
- ->setStateWeight('fresh', -5)
- ->addState('rotten', $this->t('Rotten'))
- ->addTransition('rot', $this->t('Rot'), ['fresh'], 'rotten');
- return $workflow;
- }
-
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
- // No configuration is stored for the test type.
- return [];
+ return [
+ 'states' => [
+ 'fresh' => [
+ 'label' => 'Fresh',
+ 'weight' => 0,
+ ],
+ 'rotten' => [
+ 'label' => 'Rotten',
+ 'weight' => 1,
+ ],
+ ],
+ 'transitions' => [
+ 'rot' => [
+ 'label' => 'Rot',
+ 'to' => 'rotten',
+ 'weight' => 0,
+ 'from' => [
+ 'fresh',
+ ],
+ ],
+ ],
+ ];
}
}