2

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:

dsm($node);
dsm($entity);
dsm($object);

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 '14 at 9:34
3

SOLVED!

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, privacy policy and cookie policy

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