I need to, given the midmid
(Message= Message ID), generate the Message content for a specific view mode. How can I do this?
It seems to be complicated by the fact that a Message is an entity (created by the Message module), and there are multiple Message types, each of which have their own fields and rely heavily on tokens.
I'm hoping for something simple like:
$message = message_load($mid, $view_mode);
$output = drupal_render(entity_view($message));
...but but everything I've found that loads Messages seems to rely on weird wrappers and stuff and I haven't been able to find a working solution no matter how much I tinker with it.