Drupal - How to display the summary (teaser) over the body in a full content view

You can do this with Views. Create a view that overrides the paths for your content type. Set the display to Fields and then add the body field twice; set the first instance to display the teaser and the second instance to display the body. You can add the images in between. Views will also allow you to customize the CSS of the teaser/body fields easily (by default, Views provides a number of classes, and you can add additional classes if necessary).

For reference: Node One series of video screencasts on using Views


Views can definitely do the job. But I think it is a little bit overkill for this requirement.

Another way to achieve that is implement hook_field_extra_fields() and hook_node_view() in your custom module.

/**
 * Implements hook_field_extra_fields().
 */
function mymodule_field_extra_fields() {
  // Put the content type you want to display summary field here.
  $content_type = 'page';

  $extra['node'][$content_type]['display']['body_summary'] = array(
    'label' => t('Body summary'),
    'description' => t('Display body summary.'),
    'weight' => 0,
  );

  return $extra;
}

/**
 * Implements hook_node_view().
 */
function mymodule_node_view($node, $view_mode, $langcode) {
  // Put the content type you want to display summary field here.
  $content_type = 'page';

  if ($node->type == $content_type) {
    $summary = field_view_field('node', $node, 'body', array(
      'type' => 'text_summary_or_trimmed',
    ));

    $node->content['body_summary'] = array(
      '#markup' => $summary,
      '#weight' => 0,  
    );
  }
}

Clear the cache and you can go to the content type "Manage display" settings to drag and drop to place the "body summary" field. For example admin/structure/types/manage/page/display.


on drupal 7:

In the field Body you can use 'rewrite result' and use in the 'replacement patterns' this:

[body-summary]

and this this will display the full summary.

Tags:

Entities

Nodes

7