I create a code field in Display Suite module and I need to insert a format_plural in it like

print format_plural([node:comment-count],  '1 Comment',  '@count Comments');

but token do not work in php block so I tryed:


but they do not work because 'Undefined variable' error. Where is the node variable in display suite code field?

How can I achieve this output?

There is the screenshots field error

  • There's no implicit reason that you'd have access to the entity object within the PHP filter, it depends on what the caller has put into scope for you. dpm(get_defined_vars()); should tell you what's available
    – Clive
    Sep 16, 2014 at 9:34

1 Answer 1



I needed to enable 'Display Suite Format' module.
If enable it give me a new text format 'Display Suite code' which give an $entity variable inside a code field!

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.