You are here

function hook_state_flow_entity_plugins in State Machine 7.3

Implements hook_state_flow_entity_plugins().

Define the ctools plugin to add a new state machine type.

2 functions implement hook_state_flow_entity_plugins()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

state_flow_entity_state_flow_entity_plugins in modules/state_flow_entity/state_flow_entity.module
Implements hook_state_flow_entity_plugins().
state_flow_state_flow_entity_plugins in modules/state_flow/state_flow.module
Implements hook_state_flow_entity_plugins().

File

modules/state_flow_entity/state_flow_entity.api.php, line 13
Define a new StateMachine for the node

Code

function hook_state_flow_entity_plugins() {
  $info = array();
  $path = drupal_get_path('module', 'state_flow') . '/plugins';
  $workflow_options = array(
    'states' => array(
      'draft' => array(
        'label' => t('Draft'),
      ),
      'published' => array(
        'label' => t('Published'),
        'on_enter' => 'on_enter_published',
        'on_exit' => 'on_exit_published',
      ),
      'unpublished' => array(
        'label' => t('Unpublished'),
      ),
    ),
    'default_state' => 'draft',
    'events' => array(
      'publish' => array(
        'label' => t('Publish'),
        'origin' => 'draft',
        'target' => 'published',
      ),
      'unpublish' => array(
        'label' => t('Unpublish'),
        'origin' => 'published',
        'target' => 'unpublished',
        'permission' => 'publish and unpublish content',
      ),
      'to draft' => array(
        'label' => t('To Draft'),
        'origin' => 'unpublished',
        'target' => 'draft',
      ),
    ),
  );
  $info['state_flow_node'] = array(
    'handler' => array(
      'class' => 'StateFlowNode',
      'file' => 'state_flow_node.inc',
      'path' => drupal_get_path('module', 'state_flow') . '/plugins',
      'parent' => 'state_flow_entity',
      'workflow_options' => $workflow_options,
      'entity_type' => 'node',
      // See state_flow.forms.inc for details on event_form_options.
      'event_form_options' => array(),
    ),
  );
  return $info;
}