Skip to content

Instantly share code, notes, and snippets.

@pcave
Created February 26, 2015 16:21
Show Gist options
  • Save pcave/6385f4943ad8a5ee337e to your computer and use it in GitHub Desktop.
Save pcave/6385f4943ad8a5ee337e to your computer and use it in GitHub Desktop.
Message action load, attaching messages
function sba_message_action_node_load($nodes, $types) {
// If no message_action nodes are loaded no need to continue.
if (!in_array('sba_message_action', $types)) {
return;
}
// Add full messages to each node so we can utilize them later.
foreach ($nodes as $nid => $node) {
if ($node->type == 'sba_message_action') {
$messages = entity_load('sba_message', $node->message_ids);
$node->messages = $messages;
// Probably do some other stuff here, like look at the messages and
// determine if they're edtiable, etc.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment