Monday, January 31, 2011

How to Attach JavaScript and CSS for drupal_render in Drupal 7


<?php
function example_admin_settings() {
 
$form['#attached_css'] = array(
    drupal_get_path('module', 'example') . '/example.admin.css'
 
),
 
$form['#attached_js'] = array(
    'alert("Hello World.");' => 'inline',
    array(
     
'data' => array('mymodule' => array(...)),
     
'type' => 'setting'
   
),
  );
 
$form['example'] = array(
   
'#type' => 'fieldset',
   
'#title' => t('Example');
  );
  return
$form;
}
?>

For more please visit:

No comments:

Post a Comment