stephaneerard/dmJavascriptPlugin
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
This plugin will allow you to do things such as :
Augment the dm_configuration object of Diem, using
$js->config(array('do_not_hide_fieldsets' => true));
Which will result in something like :
var dm_configuration = {"relative_url_root":"","dm_core_asset_root":"\/dmCorePlugin\/","script_name":"\/admin_dev.php\/","debug":true,"culture":"fr","dateFormat":"dd\/mm\/yy","module":"companyCoreAdmin","action":"edit","authenticated":true,"do_not_hide_fieldsets":true,"record_id":"6"};
Add Javascript code at the very end of your page, using
$js->code('alert(?);', array('hello'));
Which will result in something like :
/* <![CDATA[ */;(function($){$(document).ready(function(){alert("hello");});})(jQuery);/* ]]> */
The $js object is an instance of dmJavascript, which is available as a service under the name of dm_javascript !
Get it within an action's method scope, a record's method scope :
$this->getService('dm_javascript');
Get it within a template scope :
$sf_context->get('dm_javascript');