Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • CiviCRM Core CiviCRM Core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 1k
    • Issues 1k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • DevelopmentDevelopment
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #3962

Bool token formatting

I hit an issue today where we were using tokens in smarty. We already have this format in several message templates - e.g

{if '{contact.current_employer}'} ({contact.current_employer}){/if}

The single quotes are necessary as {if } {/if} will fail - so it renders to {if ''} {/if}

However, the problem we hit is if the employer is O'Malley Construction' which renders as {if 'O'Malley Construction'} {/if}

I think the solution is to add a bool modifier & allow any token to be passed through it - it would also simplify the smarty a little - ie

{if {contact.current_employer|bool}} ({contact.current_employer}){/if}

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking