I am trying to create custom Display Suite code field.

I would like to show truncated text of node body or teaser if exists (+ other stuff, like: (...) and link to current node)

I tried to use [node:teaser] but nothing was showed. I tried to use [node:body:?] token too, but all options I have tried failed for me.

Field code:

[node:teaser] (...) <a class="read-more" href="[node:url]"><?php print t('read more'); ?></a>

Any suggestions?

It so basic thing but I have no idea what I am doing wrong here...

  • are you using views? or from the full content you need to display the teaser?
    – cayerdis
    Feb 12, 2013 at 17:12
  • 1
    I am using Views, anyway I solved this by creating preprocess function for this field inside template.php.
    – Codium
    Feb 12, 2013 at 17:43
  • Mind posting your answer below?
    – chrisjlee
    Apr 19, 2013 at 17:00

1 Answer 1


I did this by adding a preprocess field which then becomes available in DS.

      function MYTHEME_preprocess_node(&$variables) {
        // Get the summary as a discrete field.
        $body = array_pop(field_get_items('node', $variables['node'], 'body'));
        $variables['node_summary'] = $body['safe_summary'];

Then in display suite add a preprocess field named node_summary.

Your Answer

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

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