Example of register('javascript-inline')
Permalink
I'm trying to use the AssetList to include some inline JavaScript in a package's block:
I'm requiring the assets in the method "registerViewAssets". This all works fine, until I try to edit the block.
Then some eval function is trying add the JavaScript to ccm_addHeaderItem and the double quotes are giving issues.
How can this problem be fixed? Or am I doing something fundamentally wrong here?
$al->register( 'javascript-inline', 'js_init', 'jQuery(document).ready(function() { ' . 'obj = new form("234", {' . '"date_format": "dd-mm-yy",' . '});' . '});' );
I'm requiring the assets in the method "registerViewAssets". This all works fine, until I try to edit the block.
Then some eval function is trying add the JavaScript to ccm_addHeaderItem and the double quotes are giving issues.
How can this problem be fixed? Or am I doing something fundamentally wrong here?