Commit d37bd271 authored by fmitchell's avatar fmitchell

Issue #1701622 by Brandonian On hook_state_flow_event_fired, is sometimes not an object/null

parent 86b58dbd
7.x-2.x
--------------
#1701622: On hook_state_flow_event_fired, $node is sometimes not an object/null
#1615258: Views Field State Flow: Event links is Broken
#1493088: Include the vid of a new draft in the node object
#1528968: Provide hooks for altering the workflow tab content
......
......@@ -303,17 +303,20 @@ function state_flow_entity_get_state($data, $options, $name, $type, $info) {
function state_flow_invoke_event_handlers(StateMachine $state_machine, $event_key, $uid, $log) {
// Load related objects
$object = $state_machine->get_object();
$state = $state_machine->get_current_state();
$node = node_load($object->nid, $object->vid);
$author = !empty($node->uid) ? user_load($node->uid) : drupal_anonymous_user();
if (is_object($object)) {
$state = $state_machine->get_current_state();
// Invoke the Rules state_flow_event_fired event.
if ($node && module_exists('rules')) {
rules_invoke_event('state_flow_event_fired', $node, $author, $state);
}
$node = node_load($object->nid, $object->vid);
$author = !empty($node->uid) ? user_load($node->uid) : drupal_anonymous_user();
// Invoke the Rules state_flow_event_fired event.
if ($node && module_exists('rules')) {
rules_invoke_event('state_flow_event_fired', $node, $author, $state);
}
module_invoke_all('state_flow_event_fired', $node, $event_key, $uid, $log);
module_invoke_all('state_flow_event_fired', $node, $event_key, $uid, $log);
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment