Hi

I have set the description field format to visible for the teaser of the recipe content type but it's the only field set to this that does not appear. This happened even when I made a fresh installation again. I would like to have the desciption forming the main part of the teaser.

How do I get this to work?

Regards

Comments

dcam’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #1264498: Recipe fields are not shown in the node teaser list. If this is still a problem, there is some sample code in that issue to enable the display.

lionheart8’s picture

Hi,
Thank you for this response.
I tried to look at the code at that link, but could not make out what exactly to be done to correct the issue.
Yes, this is after this long, about 1.5 years later (!) after original post still a problem.

I am NOT a coder, so unless I know which specific provided code to add to what part of a stated script, all this looks like Chinese to me. ;)
.... So I would appreciate any specific solution.

Kind regards

dcam’s picture

Yes, you're right. It's still a problem. The node displays are hard-coded into the module with an old API and the fact that they're displayed in the Field UI is misleading. Unfortunately, there's no straightforward way to resolve the two that I'm aware of. The module will have to undergo a major conversion to make it work. In the meantime, the module code has to be hacked by anyone who wants to change the node display.

To make the description appear in the teaser, copy and paste the following lines of code to line 791 of recipe.module:

<?php
  $node->content['recipe_description'] = array(
      '#markup' => theme('recipe_description', array('node' => $node)),
  );
?>

So that section of code should look like:

<?php
  // If it is a teaser, you're done.
  // The teaser should have a full $node object, but not the $node->content render array.
  if ($view_mode == 'teaser') {
    $node->content['recipe_description'] = array(
      '#markup' => theme('recipe_description', array('node' => $node)),
    );
    return $node;
  }
?>

Or, if you just want the description text to be printed with no other themeing, use this:

<?php
  // If it is a teaser, you're done.
  // The teaser should have a full $node object, but not the $node->content render array.
  if ($view_mode == 'teaser') {
    $node->content['recipe_description'] = array(
      '#markup' => $node->recipe_description,
    );
    return $node;
  }
?>