Skip to content

Allow variables to use multiple modifiers #136

Description

@helmi-pts

Description of the problem

JSON Variable Modifiers does not parse / ignore file field with image manipulation; instead it will only output the original file url

How To Reproduce

  1. Create a file field
  2. Create any setting for Constrain or Crop in the File Manager page
  3. Upload file
  4. Parse template using:
    {your_file_field:json}
    {your_file_field:your_crop:json}

Error Messages

No error message. Instead it will output both tags value as the original file name url.

Environment Details:

  • Version: [e.g. 5.1.3]
  • PHP Version [e.g. 7.2]
  • MySQL Version [e.g. 5.7]
  • OS: [e.g. Linux]
  • Web Server: [Apache]

Possible Solution

Additional context

Activity

  1. kevincupp commented on Feb 26, 2019

    @kevincupp
    Contributor

    This is because your_crop is a modifier and json is a modifier, and you currently cannot have more than one modifier on a variable. If this specific use case is to be fixed, then that fundamental change needs to be made to the template parser.

  2. changed the title [-]JSON variable modifier ignores file image manipulation[/-] [+]Allow variables to use multiple modifiers[/+] on Feb 26, 2019
  3. aasun commented on Oct 12, 2021

    @aasun

    Definitely would love being able to use more than 1 modifier on a variable. Specific scenario:

    I want to use :attr_safe to remove HTML tags from a string to display it as plain text. But, when the BR tags are removed, there are no spaces between those words.. So, I want to do a :replace to first replace any BRs with a space character, then :attr_safe to remove the remaining HTML, resulting in a plain text string.

    Alternatively, maybe add more options to the existing modifiers so we can do more with them.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions