Hi,

I wrote a js library which uses the jQuery datepicker module.

Whenever this library is used by drupal_add_library a callback should be called to
set the date format depending on the users language.

Although drupal_process_attached supports callback functions drupal_add_library does not.

The solution would be quite simple:

if(isset($library['callback'])){
  $elements['#attached']+=$library['callback'];
}

This would allow to register callbacks similar to the second drupal_process_attached example:
http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_pr...

CommentFileSizeAuthor
drupal_add_library.patch486 bytesjantimon

Comments

nod_’s picture

Status: Active » Closed (won't fix)

That should happen in hook_library_info_alter(). Won't work with caching otherwise, see #1996238: Replace hook_library_info() by *.libraries.yml file and #1787758: drupal_get_library() / hook_library_info() is not cached.