#1 March 21, 2016 9:56pm

davidnewcomb
Member
Registered: March 17, 2016
Posts: 7

New field type "Raw"

I've created a routed template in order to build a "contact us" page. I have created a resource of type "Text Area" called "email_addresses" with the subtitle "Email recipients, one per line e.g. David Newcomb <david.newcomb@example.com>".
I have built a form and I want to loop through this list sending emails to each recipient. Unfortunately when I retrieve the text area contents all the < and > have been converted to &lt; and &gt;.
It looks like I'll have to do some html_entity_decode'ing but it occurred to me that a Raw field type would be more useful as it could be used to store other things that don't want to be mangled.

Last edited by davidnewcomb (March 21, 2016 10:02pm)

Offline

#2 March 24, 2016 1:50pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: New field type "Raw"

I've considered putting up a Raw Text / Raw Text Area extension field type in the extensions archive. So far I haven't done so just because of how simple they are to implement -- you just create a new field type in the Dev section and edit the process file to remove htmlspecialchars() from the $field["output"] = htmlspecialchars($field["input"]). If you think it would be valuable for newer developers let me know and I'll try to get that put together!

Offline

#3 March 24, 2016 5:52pm

davidnewcomb
Member
Registered: March 17, 2016
Posts: 7

Re: New field type "Raw"

It was pretty simple to convert it each time but I think that in order to conform to DRY principles the repeated code should be held in the type rather than in everyone's code. It doesn't really matter if it's one line of code or a hundred lines: principles are principles wink

Offline

#4 March 25, 2016 3:50pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 970

Re: New field type "Raw"

I've just released an extension that implements these field types:

https://www.bigtreecms.org/extensions/d … eld-types/

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.