It would be great to be able to choose multiple fields for the teaser view - eg I'm using the star rating module and I'd like to be able to multi-select both that and the custom teaser field that I made to both show in the teaser view. Ideally I suppose there'd also be a way to order how the fields appear.

Comments

nedjo’s picture

Sounds potentially useful but perhaps clunky to implement. Maybe though we could consider the option of selecting a fieldgroup to use? That way the grouping of fields is already handled.

JSurf’s picture

Did a heavy modification of cck_teaser_field.

Since one can select what CCK fields to display in teaser and body in the CCK fields anyways, you just have to get rid of the original text and let CCK do the work

function cck_teaser_field_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
   if ($op == 'view' && $teaser && $field = variable_get('teaser_field_'. $node->type, 0)) {
      if (isset($node->content[$field]) && !empty($node->content[$field]['#value'])) {
         $node->teaser = "";
         $node->body = "";
         $node->content['body']['#value'] = "";
         $node->readmore = TRUE;
      }
   }
}
nedjo’s picture

Status: Active » Needs work

Very nice change JSurf. It makes the module much more useful and flexible. I've applied to HEAD a modified version of this patch that changes the configuration option to a boolean. I haven't done an update function yet. It will function without one (the old field name string values will be recognized), but for cleanness we should fix up legacy data.

doc2@drupalfr.org’s picture

Suscribing :)

TBarregren’s picture

Very elegant and clever solution in all its simplicity. Bravo!

I believe it is safe to make a release out of it, although I haven't test it extensively. Meanwhile it can be downloaded from http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/cck_teaser_....

chasz’s picture

+1

TBarregren’s picture

This solution is included in the beta1 release for D6 of Nedjo's D6 port from March, 2008.