Commit d2b98fb1 authored by bojanz's avatar bojanz

Add a test module, move the sample workflow and workflow groups there.

parent 5ada0584
<?php
/**
* @file
* Contains \Drupal\state_machine_test\WorkflowGuard\FulfillmentGuard.
*/
namespace Drupal\state_machine_test\WorkflowGuard;
use Drupal\state_machine\WorkflowGuard\WorkflowGuardInterface;
use Drupal\state_machine\Plugin\Workflow\WorkflowInterface;
use Drupal\state_machine\Plugin\Workflow\WorkflowTransition;
use Drupal\Core\Entity\EntityInterface;
class FulfillmentGuard implements WorkflowGuardInterface {
/**
* {@inheritdoc}
*/
public function allowed(WorkflowTransition $transition, WorkflowInterface $workflow, EntityInterface $entity) {
// @todo Add an additional condition here that makes sense for tests.
if ($transition->getId() == 'fulfill') {
return FALSE;
}
}
}
name: State Machine Test
type: module
core: 8.x
hidden: true
state_machine_test.fulfillment_guard:
class: Drupal\state_machine_test\WorkflowGuard\FulfillmentGuard
tags:
- { name: state_machine.workflow_guard, group: order }
order:
label: Order
entity_type: commerce_order
order_payment:
label: Order (Payment)
entity_type: commerce_order
......@@ -5,24 +5,16 @@ default:
states:
new:
label: New
validation:
label: Validation
fulfillment:
label: Fulfilment
completed:
label: Completed
canceled:
label: Canceled
returned:
label: Returned
transitions:
create:
label: Create
from: [new]
to: validation
validate:
label: Validate
from: [validation]
to: fulfillment
fulfill:
label: Fulfill
......@@ -32,8 +24,3 @@ default:
label: Cancel
from: [new, validation, fulfillment]
to: canceled
return:
label: Return
from: [completed]
to: returned
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment