function theme_html_tag

7.x theme.inc theme_html_tag($variables)

Returns HTML for a generic HTML tag with attributes.

Parameters

$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:

      • meta: To provide meta information, such as a page refresh.
      • link: To refer to stylesheets and other contextual information.
      • script: To load JavaScript.
    • #attributes: (optional) An array of HTML attributes to apply to the tag.
    • #value: (optional) A string containing tag content, such as inline CSS.
    • #value_prefix: (optional) A string to prepend to #value, e.g. a CDATA wrapper prefix.
    • #value_suffix: (optional) A string to append to #value, e.g. a CDATA wrapper suffix.

Related topics

1 theme call to theme_html_tag()
drupal_get_js in drupal/includes/common.inc
Returns a themed presentation of all JavaScript code for the current page.
7 string references to the theme hook from theme_html_tag()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

drupal_add_html_head in drupal/includes/common.inc
Adds output to the HEAD tag of the HTML page.
drupal_common_theme in drupal/includes/common.inc
Provides theme registration for themes across .inc files.
drupal_get_js in drupal/includes/common.inc
Returns a themed presentation of all JavaScript code for the current page.
drupal_pre_render_styles in drupal/includes/common.inc
#pre_render callback to add the elements needed for CSS tags to be rendered.
RenderElementTypesTestCase::testHtmlTag in drupal/modules/simpletest/tests/theme.test
Tests system #type 'html_tag'.

... See full list

File

drupal/includes/theme.inc, line 2277
The theme system, which controls the output of Drupal.

Code

function theme_html_tag($variables) {
  $element = $variables['element'];
  $attributes = isset($element['#attributes']) ? drupal_attributes($element['#attributes']) : '';
  if (!isset($element['#value'])) {
    return '<' . $element['#tag'] . $attributes . " />\n";
  }
  else {
    $output = '<' . $element['#tag'] . $attributes . '>';
    if (isset($element['#value_prefix'])) {
      $output .= $element['#value_prefix'];
    }
    $output .= $element['#value'];
    if (isset($element['#value_suffix'])) {
      $output .= $element['#value_suffix'];
    }
    $output .= '</' . $element['#tag'] . ">\n";
    return $output;
  }
}