Inside module_name.module, add:
/**
* Implements hook_block_info().
*/
function example_block_info() {
$blocks['ad_banner1'] = array(
'info' => t('Ad Banner 1'),
);
$blocks['ad_banner2'] = array(
'info' => t('Ad Banner 2'),
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function example_block_view($delta = '') {
$block = array();
switch ($delta) {
case 'ad_banner1':
$block['content'] = 'shtuffenins';
break;
case 'ad_banner2':
$block['content'] = 'shtuffenins2';
break;
}
//associate js and css
$path = drupal_get_path('module', 'example');
drupal_add_js($path . '/js/example-scripts.js');
drupal_add_css($path . '/css/example-styles.css');
return $block;
}
Example of js file:
jQuery(document).ready(function ($) {
//your code goes here
});
No comments:
Post a Comment