You are here

function state_flow_entity_info_alter in State Machine 7.3

Implements hook_entity_info_alter().

File

modules/state_flow/state_flow.module, line 236
An implementation of node revision workflow for Drupal based on the State Machine system.

Code

function state_flow_entity_info_alter(&$entity_info) {

  // Add state_flow_information to the node entity type.
  if (!empty($entity_info['node'])) {
    $entity_info['node']['state_flow_entity'] = array(
      // @todo, there will likely be more properties needed here.
      'revision_workflow_path' => 'node/%entity_id/revisions/%revision_id/workflow',
      'revision_delete_path' => 'node/%entity_id/revisions/%revision_id/delete',
      'revision_edit_path' => 'node/%entity_id/revisions/%revision_id/edit',
    );

    // Add revision handling path schemes for entity translation.
    if (module_exists('entity_translation')) {
      if (!isset($entity_info['node']['translation']['entity_translation'])) {
        $entity_info['node']['translation']['entity_translation'] = array();
      }
      $entity_info['node']['state_flow_entity']['revision_translate_path'] = 'node/%entity_id/revisions/%revision_id/translate';
      $et_info =& $entity_info['node']['translation']['entity_translation'];
      $et_info['path schemes']['state_flow'] = array(
        'admin theme' => 1,
        'base path' => 'node/%node/revisions/%state_flow_revision_node',
        'view  path' => 'node/%node/revisions/%/view',
        'edit path' => 'node/%node/revisions/%state_flow_revision_node/edit',
        'path wildcard' => '%node',
        'edit tabs' => TRUE,
      );
    }
  }
}