5

I have redesigned the layout of the page using the display suite module. When I go to the node, I see empty fields are not there. I like to see the empty fields on the node. I have been looking for the settings and I could not find it. How can I display empty fields?

  • 6
    Have you tried drupal.org/project/empty_fields – Patrick Ryan Apr 11 '15 at 22:45
  • @Drupol Did you look at the module suggested by Patrick Ryan? Did you try it already, but it doesn't meet your needs? Are you looking for code to implement in a module? – kiamlaluno Jul 3 '16 at 5:09
0

I never did it I have a small though...

Write a customer formatter (module /custom_formatters) for this field which outputs for the length of the field &nsbp;

Another option is maybe to add custom tokens which a writing blank spaces and set the initial value to this token.

0

Display suite accepts custom templates that override the default layouts.

An easy way to achieve what you want if you are using a custom theme is add a custom template override for whatever DS layout - 2 column for example - you are trying to change.

By default I think the DS templates don't show empty fields.

eg in twig:

{% if user_picture is not empty %}
  {{ user_picture }}
{% endif %}

If you always them them to be rendered - or at least some layout code around them you can add custom markup.

This article discusses the basics. It is about drupal 7 but drupal 8 matters are discussed in the comments below.

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.