Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / workflows / tests / modules / workflow_type_test / src / Plugin / WorkflowType / RequiredStateTestType.php
index 493355715a000de1530f72447e1022afff6ab946..c2c88ddcdae06287b6f75d1c35ccd19c336519a6 100644 (file)
@@ -4,7 +4,6 @@ namespace Drupal\workflow_type_test\Plugin\WorkflowType;
 
 use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\workflows\Plugin\WorkflowTypeBase;
-use Drupal\workflows\WorkflowInterface;
 
 /**
  * Test workflow type.
@@ -22,24 +21,32 @@ class RequiredStateTestType extends WorkflowTypeBase {
 
   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',
+          ],
+        ],
+      ],
+    ];
   }
 
 }