|7 – 8||
Adds attachments to a render() structure.
<?php $build['#attached'] = array( 'js' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.js'), 'css' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.css'), ); ?>
'js', 'css', and 'library' are types that get special handling. For any other kind of attached data, the array key must be the full name of the callback function and each value an array of arguments. For example:
<?php $build['#attached']['drupal_add_http_header'] = array( array('Content-Type', 'application/rss+xml; charset=utf-8'), ); ?>
External 'js' and 'css' files can also be loaded. For example:
<?php $build['#attached']['js'] = array( 'http://code.jquery.com/jquery-1.4.2.min.js' => array( 'type' => 'external', ), ); ?>
$elements The structured array describing the data being rendered.
$dependency_check When TRUE, will exit if a given library's dependencies are missing. When set to FALSE, will continue to add the libraries, even though one or more dependencies are missing. Defaults to FALSE.
FALSE if there were any missing library dependencies; TRUE if all library dependencies were met.