How to change the view mode programmatically?
Altering the view mode in the preprocess function is doing it too late.
The correct way to alter the view module is implementing hook_entity_view_mode_alter(), which is called before the entity content is rendered. For example, in node_view(), that hook is invoked from node_build_content(), which is the first function called from node_view().

  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']-&gt;language;
  }

  // Populate $node-&gt;content with a render() array.
  node_build_content($node, $view_mode, $langcode);