You are here

function workbench_workflows_create_scheduled_tansition_event in Workbench Moderation 7.2

Creates a new transition event for scheduling.

If an event is schedulable we need an event that doesn't do the transition immediately but keeps the current state and waits until the scheduled event is fired. Create such a transition event based on the schedulable event.

Parameters

object $event: Schedulable event to create transition event for.

Return value

object Transition event.

2 calls to workbench_workflows_create_scheduled_tansition_event()
workbench_workflows_load in modules/workbench_workflows/workbench_workflows.module
Load a single workbench moderation exportable.
workbench_workflows_load_all in modules/workbench_workflows/workbench_workflows.module
Load a single workbench moderation exportable.

File

modules/workbench_workflows/workbench_workflows.module, line 256
workbench_workflows.module

Code

function workbench_workflows_create_scheduled_tansition_event($event) {

  // As this is a schedulable event, it has to accepts schedule as origin state.
  $event->origin_states += array(
    'schedule' => 'schedule',
  );
  $transition_event = clone $event;
  unset($transition_event->eventid);
  $transition_event->name = 'schedule_' . $event->name;
  $transition_event->schedulable = 0;
  $transition_event->target_state = 'schedule';
  $transition_event->export_type = EXPORT_IN_CODE;
  $transition_event->export_module = 'workbench_workflows';
  $transition_event->admin_title = 'Schedule: ' . $event->admin_title;
  $transition_event->title = $transition_event->admin_title;
  return $transition_event;
}