Posted by jm.federico on November 3, 2012 at 10:17pm
7 followers
Jump to:
| Project: | Libraries API |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi guys
I was wondering if it is possible to load libraries via the #attached property from render arrays.
Cheers
Comments
#1
Ah, and if so, if any one of you could provide an example. Thankx
#2
Not sure if this is what you meant exactly but this is an example that works:
http://api.drupal.org/api/drupal/includes!ajax.inc/group/ajax/7#comment-18934
#3
@Solthun
Thanks for the link, it works with libraries registered with Drupal Core library functionality, but can't get it to work with libraries registered with Library Api module.
Cheers
#4
Yes it's possible:
<?php$form['myelement']['#attached']['libraries_load'][] = array('myAwesomeLibrary');
?>
So, in short, just add a
libraries_loadkey to your#attachedarray, with as value an array of parameters to pass to libraries_load().#5
Thanks!!!!!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.