You are here

public function StateFlowTest::init in State Machine 7.2

Same name and namespace in other branches
  1. 7 modules/state_flow/state_flow.api.php \StateFlowTest::init()

* Override the init method to set the new states * * Add a to review state and "Review" event

Overrides StateFlow::init

File

modules/state_flow/state_flow.api.php, line 136
Define a new StateMachine for the node

Class

StateFlowTest
Define a new workflow for a node type

Code

public function init() {
  self::init();
  $this
    ->add_state('review');
  $this
    ->create_event('review', array(
    'origin' => 'draft',
    'target' => 'review',
  ));

  // Initialize events
  $this
    ->create_event('publish', array(
    'origin' => 'review',
    'target' => 'published',
  ));
}