function jquery_countdown_timer_attach in jQuery Countdown Timer 7
Adds timer to the page.
Parameters
mixed $context an optional value to provide context in calls:
Return value
array an array of items to attach to the current request
1 call to jquery_countdown_timer_attach()
- jquery_countdown_timer_block_view in ./
jquery_countdown_timer.module - Implements hook_block_view().
File
- ./
jquery_countdown_timer.module, line 93 - This module provides block with a simple jQuery coundown
Code
function jquery_countdown_timer_attach($context = NULL) {
$attach = array();
$path = drupal_get_path('module', 'jquery_countdown_timer');
// add external js files
$attach['js'] = array(
$path . '/js/jquery_countdown_timer.js' => array(
'type' => 'file',
'scope' => 'footer',
),
$path . '/js/jquery_countdown_timer_init.js' => array(
'type' => 'file',
'scope' => 'footer',
),
);
// set the default date and allow other projects to modify contextually
$date = variable_get('jquery_countdown_timer_date', date('Y-m-d G:i:s'));
drupal_alter('jquery_countdown_timer_date', $date, $context);
// add js settings
$settings = array(
'jquery_countdown_timer_date' => strtotime($date),
);
$attach['js'][] = array(
'data' => array(
'jquery_countdown_timer' => $settings,
),
'type' => 'setting',
);
//add css
$attach['css'] = array(
$path . '/css/jquery_countdown_timer.css',
);
//add inline css
$font_size = variable_get('jquery_countdown_timer_font_size', 28);
$attach['css'][] = array(
'data' => '.countdownHolder {font-size: ' . $font_size . 'px}',
'type' => 'inline',
);
return $attach;
}