0

I added some new fields to Basic page:

  • teaser image
  • teaser title
  • teaser subtitle

Now I want to show 2 separate blocks in teaser that point to the same node (basic page). Is it even possible?

Example of teaser

Teaser block 1

  • title: Buy Acrobat
  • subtitle: View our software
  • image: acrobat.png

Teaser block 2

  • title: Buy InDesign
  • subtitle: Software for low prices
  • image: indesign.png

Both teasers should lead to the same basic page "Buy software".

Notice that teasers are displayed on home page (option "promote to front page") and taxonomy (View: Taxonomy).

1 Answer 1

0

There are a lot of ways you could accomplish that.

One way that seems to match your requirements is using the field collection module.

You could have a multiple value field collection field on your content type and that field collection could have your title, subtitle and image fields.

It depends somewhat on all your requirements though.

For example, this might work very well for your views (like the taxonomy one) if you want both blocks to show one after the other (since you have a view of nodes and these are both on the same node), but maybe it wouldn't be as good a solution if you wanted them spread out (in which case it might be better if they were 2 separate nodes).

3
  • How can I use the field collection with views? Another way is to disable taxonomy views and generate output manually in taxonomy-view.tpl.php. However, Drupal will still load all nodes into memory that belong to the taxonomy. Mar 16, 2015 at 14:44
  • Field collections work with views the same as any other field. You can either just add the field collection field to the view to show the whole field collection or you can add a relationship on the field collection field then access individual fields from the field collection. Depending on how you set it up you might even be able to just configure the teaser via the content type UI and use the default taxonomy term page (or view override). Or you can customise taxonomy-view.tpl.php or even as a last resort override taxonomy_term_page().
    – rooby
    Mar 16, 2015 at 23:09
  • I wouldn't worry about the taxonomy term page loading nodes into memory, that will happen no matter which option you choose because you are displaying the nodes, so they have to get loaded.
    – rooby
    Mar 16, 2015 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.