HOWTO: Add new variable parameters for the iFrame SugarField

bsoremsugar —  April 22, 2011 — 2 Comments

I ran across this interesting post from the forums earlier this week from a user who is trying to use the iFrame SugarField type in his module. While it’s very easy to pull in fields from the current record, there really isn’t a way to pull another field in as a parameter to the URL, such as the current user’s id.

Since the SugarFields framework is very extensible and customizable, this is a very simple fix to add a new parameter to the array. All that’s needed to change a template is to drop it into the same location in the custom/ directory, so just copy the include/SugarFields/Fields/Iframe/DetailView.tpl template to custom/include/SugarFields/Fields/Iframe/DetailView.tpl and make the changes noted in code below ( example based upon 6.2.0beta ).

The key here is that we do a last minute string replace to change out the placeholder [current_user_id] for the actual id of the current user. You could use this same pattern to have any other parameters in the URL handled that aren’t part of the module fields themselves.

2 responses to HOWTO: Add new variable parameters for the iFrame SugarField

  1. 

    Hi John,
    I have posted a bug about “iframe” field because the logic is not good for “https” link.
    i have no skill for provide a code, but i think it’s more simple to make a new sugarfield “iframes” and just change http to https in all files.

    bug number :42966

    Regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s