Thursday, July 26, 2012

HTML is stripped in Joomla component configuration / parameters filter

If you are looking to add HTML anywhere in Joomla and 'text filtering' option in 'global configuration' is failing then here is what you need to do

You need to add a filter='safehtml' in your field tag be it your component field or parameter e.g.

<field menu="hide" name="sharethisbtncode" type="textarea"  filter="SAFEHTML" label="Sharethis Buttons Code" description="HTML buttons code of the buttons needed to be displayed" />

Without it Joomla will use the default and strip HTML.

Also know that it will only work for simple HTML like in this example buttons code, if you are looking for including something like javascript like header of analytics or some other you will need to use filter="RAW"

Following is the list of all the filter options:


case 'RULES': // Used for permissions etc
case 'UNSET': // Does nothing.
case 'RAW': // No Filter.
case 'SAFEHTML': // Filter safe HTML.
case 'SERVER_UTC': // Convert a date to UTC based on the server timezone offset.
case 'USER_UTC': // Convert a date to UTC based on the user timezone offset.
default: // Check for a custom callback filter that you can write


For more details refer to:
http://docs.joomla.org/API16:JForm/filter

No comments:

Post a Comment