|
insertFrame
Insert a frame in a node
Installation
UseTo insert a frame in a node in drupal, add the following : [[[<url> width=<w> height=<h> scrolling=<yes|no|auto> className=<class> ID=<id> offset=<offset> allowtransparency=<true|false>]]]
Don't forget to set the input format the filter has been assigned to. Examples
[[[www.myurl.com/myapp.html]]] [[[www.myurl.com/myapp.html height=500px width=300px]]] [[[www.myurl.com/myapp.html id=myframe class=myCSSClass]]] FeaturesVersion 1.x :You can add your own tags (tag=value). To custom code with this tags, you must create a theme function. To do this, add in your template.php a function called yourtheme_insertFrame_custom($onload, $iframe_params). The first param is the default code of onload event, the second, an array of all tags of the filter. You function may return any text that will be add as is in the IFRAME html tag. You can also theme the function insertFrame_init to add javascript for example. Exemple :
// Add javascript
function mytheme_insertFrame_init() {
drupal_add_js(drupal_get_path('module', 'insertFrame') . '/myinsertFrame.js');
}
// Add resizing feature if resize=Y
function yourtheme_insertFrame_custom($onload, $iframe_params) {
if ($iframe_params["resize"] != "Y") {return $onload;}
return $onload . " onresize='resize(this)'";
}
Theming insertFrame_getURL($url) function, you can customize the url (with token module for example). To theme the function, see this example : function yourtemplage_insertFrame_getURL($url) {
return token_replace($url);
} Version 2.xAll tags can be rendered as your own by using themed function (see insertFrame_theme()) or by creating insertFrame_render_<the tag to render> function. Both have two parameters :
Functions must return html output to render the tag. Exemple : function insertFrame_render_resize($value, $params) {
if ($value != "Y") {return "";}
return "onresize='resize(this)'";}
} By default, all non-themed tags are rendered as is (tag="value"). For example, to add transparency behaviour, type : [[[url allowtransparency=true]]] insertFrame_getURL() and insertFrame_custom() have been deleted. Migrate them to insertFrame_render_url and insertFrame_render_<tag> To insert spaces in tag's values, replace them by %20. [[[url style="border:1px%20solid%20red"]]] Support of Token module for url Remarks
|
Sign in to add a comment
Hello, I'm new to Drupal and I would like to add the allowtransparency = true to the inserted iframe. I never added a function to my template.php. Would this be possible? Chantal
Add in your template.php :
function <name of your template>_insertFrame_custom($onload, $iframe_params) { return $onload . " allowtransparency='true'"; }Or get release 1.9b with allowtransparency=true tag