diff options
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index b36c4b2c4..f17256c67 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3368,6 +3368,28 @@ function drupal_render(&$elements) { } } + // Add additional CSS and JavaScript files associated with this element. + foreach (array('css', 'js') as $kind) { + if (!empty($elements['#attached_' . $kind]) && is_array($elements['#attached_' . $kind])) { + foreach ($elements['#attached_' . $kind] as $data => $options) { + // If the value is not an array, it's a filename and passed as first + // (and only) argument. + if (!is_array($options)) { + $data = $options; + $options = NULL; + } + // When drupal_add_js with 'type' => 'setting' is called, the first + // parameter ($data) is an array. Arrays can't be keys in PHP, so we + // have to get $data from the value array. + if (is_numeric($data)) { + $data = $options['data']; + unset($options['data']); + } + call_user_func('drupal_add_' . $kind, $data, $options); + } + } + } + // Get the children of the element, sorted by weight. $children = element_children($elements, TRUE); @@ -3750,6 +3772,9 @@ function drupal_common_theme() { 'text_format_wrapper' => array( 'arguments' => array('element' => NULL), ), + 'vertical_tabs' => array( + 'arguments' => array('element' => NULL), + ), ); } |