Basically I want to let the content creator choose an arbitrary view mode. For example, be able to choose a gallery that is a FlexSlider slideshow, a Masonry jQuery plugin type image gallery, or an image gallery that displays metadata below each image.
On the entity there would be a field called field_view_mode which is an options list. The options are flex slider, masonry, and full images with text. Depending on the option they get the images and other fields formatted differently in different templates.
I'm thinking about defining 5 different arbitrary view modes. One more view mode would be custom_view_mode.
function hook_entity_view_mode_alter(&$view_mode, $context) {
// For nodes, change the view mode when it is teaser.
if ($context['entity_type'] == 'node' && $view_mode == 'custom_view_mode') {
$view_mode = 'use entity metadata wrapper to pull field_view_mode value here';
}
}
I don't want to use the Template Field module because it seems like overkill. I'm not sure if the Display Suite module does this but that seems like overkill too. I just want different view modes to be available. Has anyone done this before?