public function buildTagAttributes(array $attributes)
{
$html = array();
foreach ($attributes as $key => $value) {
if (is_null($value)) {
continue;
}
if (is_numeric($key)) {
$key = $value;
}
$html[] = $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
}
return count($html) > 0 ? ' ' . implode(' ', $html) : '';
}