summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc49
-rw-r--r--includes/theme.inc30
2 files changed, 34 insertions, 45 deletions
diff --git a/includes/common.inc b/includes/common.inc
index a1996a189..fb4aff11d 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3663,28 +3663,6 @@ 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);
@@ -3716,6 +3694,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);
+ }
+ }
+ }
$prefix = isset($elements['#prefix']) ? $elements['#prefix'] : '';
$suffix = isset($elements['#suffix']) ? $elements['#suffix'] : '';
@@ -3982,9 +3982,6 @@ function drupal_common_theme() {
'item_list' => array(
'arguments' => array('items' => array(), 'title' => NULL, 'type' => 'ul', 'attributes' => NULL),
),
- 'list' => array(
- 'arguments' => array('elements' => NULL),
- ),
'more_help_link' => array(
'arguments' => array('url' => NULL),
),
@@ -4011,7 +4008,7 @@ function drupal_common_theme() {
),
// from pager.inc
'pager' => array(
- 'arguments' => array('tags' => array(), 'element' => 0, 'parameters' => array()),
+ 'arguments' => array('tags' => array(), 'element' => 0, 'parameters' => array(), 'quantity' => 9),
),
'pager_first' => array(
'arguments' => array('text' => NULL, 'element' => 0, 'parameters' => array()),
diff --git a/includes/theme.inc b/includes/theme.inc
index 7558d2b1d..41bdcf347 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -724,6 +724,17 @@ function theme() {
if (isset($info['function'])) {
// The theme call is a function.
if (drupal_function_exists($info['function'])) {
+ // If a theme function that does not expect a renderable array is called
+ // with a renderable array as the only argument (via drupal_render), then
+ // we take the arguments from the properties of the renderable array. If
+ // missing, use hook_theme() defaults.
+ if (isset($args[0]) && is_array($args[0]) && isset($args[0]['#theme']) && count($info['arguments']) > 1) {
+ $new_args = array();
+ foreach ($info['arguments'] as $name => $default) {
+ $new_args[] = isset($args[0]["#$name"]) ? $args[0]["#$name"] : $default;
+ }
+ $args = $new_args;
+ }
$output = call_user_func_array($info['function'], $args);
}
}
@@ -1659,25 +1670,6 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
}
/**
- * Return a themed list of items from a drupal_render() style array.
- *
- * @param $elements
- * An array consisting of the following keys:
- * - #items: an array of items as expected by theme('item_list').
- * - #title: a title which prints above the list.
- * - #list_type: the type of list to return. Defaults to "ul".
- * - #attributes: an array of attributes as expected by theme('item_list').
- * @return
- * A string containing the list output.
- */
-function theme_list($elements) {
- // Populate any missing array elements with their defaults.
- $elements += element_info('list');
-
- return theme('item_list', $elements['#items'], $elements['#title'], $elements['#list_type'], $elements['#attributes']);
-}
-
-/**
* Returns code that emits the 'more help'-link.
*/
function theme_more_help_link($url) {