Returns HTML for a meter.
$variables: An associative array containing:
function theme_meter($variables) {
$attributes = $variables['attributes'];
foreach (array(
'form',
'high',
'low',
'max',
'min',
'optimum',
'value',
) as $attribute) {
if (!empty($variables[$attribute])) {
// This function was initially designed for the <meter> tag, but due to
// the lack of browser and styling support for it, we're currently using
// it's attributes as HTML5 data attributes.
$attributes['data-' . $attribute] = $variables[$attribute];
}
}
$output = '<div' . new Attribute($attributes) . '>';
$output .= ' <div style="width: ' . $variables['percentage'] . '%;" class="foreground"></div>';
$output .= "</div>\n";
if (!empty($variables['display_value'])) {
$output .= '<div class="percent">' . $variables['display_value'] . '</div>';
}
return $output;
}