function opening_hours_add_js in Opening hours 7
Same name and namespace in other branches
- 6 opening_hours.module \opening_hours_add_js()
Helper function to load our JavaScript dependencies.
Kept around for backwards compatibilty. You should not call this, if possible, add opening_hours_js_attach_presentation or opening_hours_js_attach_admin to your render array instead.
It is still called in template_preprocess_opening_hours_week(), since we would need to change the API of the module if we didn't. So far, it's been possible to embed the opening hours with a single theme('opening_hours_week', $node'). If we want that, we'll have to add the JavaScript in the preprocessor, rather than the render array.
1 call to opening_hours_add_js()
- template_preprocess_opening_hours_week in ./
opening_hours.module - Preprocess variables for the week template.
File
- ./
opening_hours.module, line 656 - Opening hours module.
Code
function opening_hours_add_js($type = 'presentation', $nid = FALSE) {
if ($type == 'admin') {
$attachments = opening_hours_js_attach_admin($nid);
}
elseif ($type == 'presentation') {
$attachments = opening_hours_js_attach_presentation($nid);
}
if (!empty($attachments)) {
// Create a fake empty element, since that is what
// drupal_process_attached expects.
$fakeelement = array(
'#attached' => $attachments,
);
drupal_process_attached($fakeelement);
}
}