How do I add additional view modes for a node? I am creating a custom content type. By default, nodes support only two view modes (full and teaser):

function mymodule_view($node, $view_mode)
{
    if ($view_mode == 'full') {
         $node-&gt;content['#theme']= 'my_full_node_view_theme';
    }

    if ($view_mode == 'teaser') {
          $node-&gt;content['#theme']= 'my_teaser_node_view_theme'; 
    }
    return $node;
}


I want to add some other view modes for this node type, like:


small_box
small_box_with_user_pic
big_box


and want to render the node with code like this:

$node = node_load($my_nid);
$output = drupal_render(node_view($node, 'big_box'));


Any suggestions?
first we have to add additional view modes with hook_entity_info_alter

function customuserblog_entity_info_alter(&amp;$entity_info) {
     $entity_info['node']['view modes']['blog_post_big'] = array(
        'label' =&gt; t('simple big  teaser'),
        'custom settings' =&gt; TRUE,
      );
    }


// we may attach additional theme functions or templates and add variables with hook_view

function customuserblog_view($node, $view_mode) {
  if ($view_mode == 'blog_post_big') {
   // add some additional variables for template
    $node-&gt;content['#theme'] = 'custom_blog_big_teaser_view';
  }
}


// in our hook theme

customuserblog_theme(){
    return array(
      'custom_blog_big_teaser_view'= array(
          'render element' =&gt; 'form',
          'template' =&gt; 'custom-blog-big-teaser-view',
       ),

    );
}