Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created February 19, 2013 12:45
Show Gist options
  • Save amitaibu/4985577 to your computer and use it in GitHub Desktop.
Save amitaibu/4985577 to your computer and use it in GitHub Desktop.
/**
* Implements hook_init().
*/
function message_example_init() {
$arguments = array(
'@view' => array(
'callback' => 'message_example_view',
'pass message' => TRUE,
)
);
$message = message_create('views', array('arguments' => $arguments));
$wrapper = entity_metadata_wrapper('message', $message);
$wrapper->field_products->set($ids);
message_notify_send_message($message);
}
/**
* Message callback; Render a view.
*/
function message_example_view(Message $message) {
$wrapper = entity_metadata_wrapper('message', $message);
$ids = $wrapper->field_products->value(array('identifier' => TRUE));
$view = views_get_view('foo');
$view->set_arguments($ids);
return $view->preview();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment