Jump to content

Recommended Posts

Posted

I ran into a strange problem to do with checking if a field is empty and then rendering content or not. Having poked around a bit it seems to me that the Markdown Extra formatter is actually outputting a string with a single space in it when I have no content in that field in the CMS.

This meant that, in the context of my TWIG-powered templates, when I was checking for a non-empty field, it was returning false and still rendering something.

Can anyone confirm this for me?  I have a textarea field with a single Markdown Extra formatter.  When I enter nothing and save, then I var_dump() the field in my PHP code, I get a 1-character empty string.

Thanks in advance!

Posted

Thanks for the pointers - is the suggestion therefore that there is a bug but it's just one I have to work around?

Posted

I tried adding paragraph stripper formatter after markdown, and before, it made no difference at all.  There is an empty space at the end of whatever is generated, with or without any extra fomatters.

I guess I'll just have to work around it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...