You are here

class StateFlowTest in State Machine 7.2

Same name and namespace in other branches
  1. 7.3 modules/state_flow_entity/state_flow_entity.api.php \StateFlowTest
  2. 7 modules/state_flow/state_flow.api.php \StateFlowTest

Define a new workflow for a node type

Hierarchy

Expanded class hierarchy of StateFlowTest

1 string reference to 'StateFlowTest'
hook_state_flow_plugins in modules/state_flow/state_flow.api.php
Implements hook_state_flow_plugins().

File

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

View source
class StateFlowTest extends StateFlow {

  /**
   * Override the init method to set the new states
   *
   * Add a to review state and "Review" event
   */
  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',
    ));
  }

  /**
   * Override workflow from working on certain content types
   *
   * @return bool
   */
  public function ignore() {
    if ($this->object->type == 'ctype') {
      return TRUE;
    }
    return FALSE;
  }

  /**
   * Override what event is used to skip directly to publish
   *
   */
  public function skip_to_publish() {
    return 'immediate publish';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
StateFlow::existing_revision public function
StateFlow::fire_event public function Extending fire_event() from state_machine's base.inc to add uid and log arguments. Overrides StateMachine::fire_event
StateFlow::get_event public function Return an event instance by key, lazy-loading the instance if necessary. Overrides StateMachine::get_event
StateFlow::get_label_for_current_state public function Get the label for the current state
StateFlow::get_latest_revision public function
StateFlow::get_object public function
StateFlow::get_states_options public function
StateFlow::latest_state public function
StateFlow::load public function Load the current state from the given state storage Overrides StateMachine::load
StateFlow::on_enter_published public function
StateFlow::on_event_fail public function Method to be called when firing an event fails for any reason. Overrides StateMachine::on_event_fail
StateFlow::on_exit_published public function
StateFlow::on_exit_scheduled public function
StateFlow::persist public function Persist the current state to the object storage. Overrides StateMachine::persist
StateFlow::revision_state public function
StateFlow::revision_state_record public function
StateFlow::set_node_revision public function
StateFlow::set_principle_revision public function
StateFlow::set_published public function
StateFlow::set_unpublished public function
StateFlow::write_history public function
StateFlowTest::ignore public function * Override workflow from working on certain content types * * Overrides StateMachine::ignore
StateFlowTest::init public function * Override the init method to set the new states * * Add a to review state and "Review" event Overrides StateFlow::init
StateFlowTest::skip_to_publish public function Override what event is used to skip directly to publish Overrides StateFlow::skip_to_publish
StateMachine::$current protected property
StateMachine::$events protected property
StateMachine::$initial protected property
StateMachine::$object protected property
StateMachine::$states protected property
StateMachine::create_event protected function Create a new event. This method does not actually create an event instance, it only stores the options array until an instance is requested from get_event().
StateMachine::create_state protected function Create a new state. This method does not actually create a state instance, it only stores the options array until an instance is requested from get_state().
StateMachine::get_all_events public function Get all of the events
StateMachine::get_available_events public function Returns an array of events that are valid for the current state.
StateMachine::get_current_state public function Returns the current state.
StateMachine::get_state protected function Return a state instance by key, lazy-loading the instance if necessary.
StateMachine::set_current_state protected function Set the current state to the state identified by the specified key.
StateMachine::set_initial_state protected function Set the initial state for this machine. By default, the initial state is set the the first created state.
StateMachine::__construct public function