Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.553
diff -u -p -r1.553 theme.inc
--- includes/theme.inc 20 Nov 2009 04:29:42 -0000 1.553
+++ includes/theme.inc 24 Nov 2009 04:53:36 -0000
@@ -1907,13 +1907,13 @@ function theme_feed_icon($variables) {
/**
* Generate the output for a generic HTML tag with attributes.
*
- * This theme function should be used for tags appearing in the HTML HEAD of a
- * document (specified via the #tag property in the passed $element):
+ * This theme function is most commonly used for, but not restricted to tags
+ * appearing in the HTML HEAD of a document.
*
* @param $variables
* An associative array containing:
* - element: An associative array describing the tag:
- * - #tag: The tag name to output. Typical tags added to the HTML HEAD:
+ * - #tag: The tag name to output. Typical tags added to the HTML HEAD:
* - meta: To provide meta information, such as a page refresh.
* - link: To refer to stylesheets and other contextual information.
* - script: To load JavaScript.
@@ -1924,12 +1924,19 @@ function theme_feed_icon($variables) {
* wrapper prefix.
* - #value_suffix: (optional) A string to append to #value, e.g. a CDATA
* wrapper suffix.
+ * - #minimized: (optional) Can be set to TRUE or FALSE to force the
+ * rendered output to use the minimized tag syntax (e.g., "")
+ * or not (e.g., ""). If not specified, this defaults
+ * to the XHTML guidelines (http://www.w3.org/TR/xhtml1/#guidelines).
*
* @ingroup themeable
*/
function theme_html_tag($variables) {
+ // http://www.w3.org/TR/xhtml1/dtds.html
+ static $tags_with_empty_content_model = array('area', 'base', 'basefont', 'br', 'col', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param');
$element = $variables['element'];
- if (!isset($element['#value'])) {
+ $minimized = isset($element['#minimized']) ? $element['#minimized'] : in_array(strtolower($element['#tag']), $tags_with_empty_content_model);
+ if ($minimized && !isset($element['#value'])) {
return '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . " />\n";
}
else {
@@ -1937,7 +1944,9 @@ function theme_html_tag($variables) {
if (isset($element['#value_prefix'])) {
$output .= $element['#value_prefix'];
}
- $output .= $element['#value'];
+ if (isset($element['#value'])) {
+ $output .= $element['#value'];
+ }
if (isset($element['#value_suffix'])) {
$output .= $element['#value_suffix'];
}