Created
November 22, 2011 19:13
-
-
Save smithmilner/1386600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns HTML for a generic HTML tag with attributes. | |
* | |
* @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: | |
* - 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. | |
*/ | |
function theme_ieg_html_tag($variables) { | |
$element = $variables['element']; | |
if (!isset($element['#children'])) { | |
return '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . " />\n"; | |
} | |
else { | |
$output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>'; | |
if (isset($element['#value_prefix'])) { | |
$output .= $element['#value_prefix']; | |
} | |
$output .= $element['#children']; | |
if (isset($element['#value_suffix'])) { | |
$output .= $element['#value_suffix']; | |
} | |
$output .= '</' . $element['#tag'] . ">\n"; | |
return $output; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment