0

I'm trying build a custom page for my content type with Views. What I've done so far:

  • Created a grid display type template, I change columns to bootstrap columns;
  • Hooked up a a template for teaser node--tutorial--teaser.tpl.php in template.php file.

What I would like to do next:

  • Modify print render($content);
  • Arrange my node teaser fields in this order: image, title, summary, other fields.

However, title seems to be seprated from content and not avaible as a field in teaser display settings.

How can I modify content output to include title and modify it's markup? What's the best way of acomplishing what I need?

Thank you

EDIT: Thanks to everyone for suggesting DIsplay Suite, but really after trying it out it just makes things more confusing... I'd much much rather assign some variables in a php files and arrange them the way I want in a template file.

  • Installing devel module can help you to view variables on your output page. – Andrew Welch Oct 19 '14 at 17:29
  • Yeah I figured that by now. Just goona use available variables in templates files and drop any generated markup, because it's uncontrollable :) – gskema Oct 20 '14 at 5:24
2

I can't say this is the best way, but may be it may help you.. So, my approach is like this:

function MYMODULE_preprocess_node(&$variables)
{
  if ($variables['teaser'] && $variables['type'] == 'TYPE') {
    $titleField['title'] = array(
        '#markup' => '<div>' . $variables['title'] . '</div>'
    );

    array_push($variables['content'], $titleField);
    ...
  }
}
0

Why not using a view of regular fields, display them as an unformatted list, then add your bootstrap classes to your rows? It should get the proper CSS and you have all the fields you need in the proper order, without templating your teasers.

0

You can always use Display Suite module to accomplish what you need. Views for modeling a list of nodes (with filters and sorting parameters) than Display Suite to overwrite standard way of node teaser/full display. I think it will fit perfect for your case.

0

You can enable 'Display Suite Extras' module and check 'Page title options' in 'Other' tab After overwrite display of node type, you can hide the title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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