Closed nlemoine closed 8 years ago
Using a regular text field:
papi_property( [ 'title' => 'Some text', 'type' => 'text', 'slug' => 'some_text', ]),
When using the_papi_field, line breaks should be converted to <br /> tags by default but are actually escaped: <br />
the_papi_field
<br />
<br />
Line breaks should be converted to <br /> tags but should not be escaped.
There's a contradiction with text property settings.
In order to allow nl2br to work, allow_html has to be set to false: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-text.php#L19
nl2br
allow_html
false
But if allow_html is set to false, the value is escaped: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-text.php#L57
Thus escaping the <br /> tags produced by nl2br.
Thanks, fixed and will be out shortly.
What happened
Using a regular text field:
When using
the_papi_field
, line breaks should be converted to<br />
tags by default but are actually escaped:<br />
What I expected
Line breaks should be converted to
<br />
tags but should not be escaped.Problem
There's a contradiction with text property settings.
In order to allow
nl2br
to work,allow_html
has to be set tofalse
: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-text.php#L19But if
allow_html
is set tofalse
, the value is escaped: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-text.php#L57Thus escaping the
<br />
tags produced bynl2br
.What versions of softwares are you using?