Skip to content

[bug] - Property/Text : nl2br #199

Closed

Description

@nlemoine

What happened

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: &lt;br /&gt;

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 to false: https://github.com/wp-papi/papi/blob/master/src/properties/class-papi-property-text.php#L19

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.

What versions of softwares are you using?

  • Papi: latest
  • WordPress: latest

Activity

  1. added a commit that references this issue on Oct 19, 2016
    3d75397
  2. frozzare commented on Oct 19, 2016

    @frozzare
    Member

    Thanks, fixed and will be out shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions