DrupalBin
Submit Code
About
Recent Posts
Code
Fix for Fix for Code
Fix for Code
Code
Node type whitelist
an axe coach accessories
coach purses married
Fix for de las ghd alturas
de las ghd alturas
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
›
Foreach!
Fix for Foreach!
View
Fix
Fixes are not saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
/** * Adds multiple JavaScript or CSS files at the same time. * * A library defines a set of JavaScript and/or CSS files, optionally using * settings, and optionally requiring another library. For example, a library * can be a jQuery plugin, a JavaScript framework, or a CSS framework. This * function allows modules to load a library defined/shipped by itself or a * depending module; without having to add all files of the library separately. * Each library is only loaded once. * * @param $module * The name of the module that registered the library. * @param $name * The name of the library to add. * @return * TRUE when the library was successfully added or FALSE if the library or one * of its dependencies could not be added. * * @see drupal_get_library() * @see hook_library() * @see hook_library_alter() */ function drupal_add_library($module, $name) { $added = &drupal_static(__FUNCTION__, array()); // Only process the library if it exists and it hasn't been added yet. if (!isset($added[$module][$name]) && $library = drupal_get_library($module, $name)) { // State that we are processing the library, so that it's not processed again. $added[$module][$name] = TRUE; // Prepare the library for addition. $library += array('dependencies' => array(), 'js' => array(), 'css' => array()); // Ensure the dependencies are available first. foreach ($library['dependencies'] as $dependency) { // Directly invoke drupal_add_library() to test its return value. The first // parameter is the library's hosting module, while the second argument is // the library's name. if (drupal_add_library($dependency[0], $dependency[1]) === FALSE) { // If any dependent library could not be added, this library will // break, so stop here. return $added[$module][$name] = FALSE; } } // Add related JavaScript. foreach ($library['js'] as $data => $options) { // For JS settings we need to transform $options['data'] into $data. if (isset($options['type'], $options['data']) && $options['type'] == 'setting') { $data = $options['data']; unset($options['data']); } // All JavaScript contained within the libraries are given a default // weight of JS_LIBRARY. elseif (!isset($options['weight'])) { $options['weight'] = JS_LIBRARY; } drupal_add_js($data, $options); } // Finally, add the stylesheets. foreach ($library['css'] as $data => $options) { drupal_add_js($data, $options); } } return $added[$module][$name]; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.