Returns HTML for a details form element and its children.
$variables: An associative array containing:
function theme_details($variables) {
$element = $variables['element'];
element_set_attributes($element, array(
'id',
));
_form_set_attributes($element, array(
'form-wrapper',
));
$output = '<details' . new Attribute($element['#attributes']) . '>';
if (!empty($element['#title'])) {
$summary_attributes = new Attribute(array(
'role' => 'button',
));
if (!empty($element['#attributes']['id'])) {
$summary_attributes['aria-controls'] = $element['#attributes']['id'];
}
$summary_attributes['aria-expanded'] = empty($element['#attributes']['open']) ? FALSE : TRUE;
$summary_attributes['aria-pressed'] = $summary_attributes['aria-expanded'];
$output .= '<summary' . $summary_attributes . '>' . $element['#title'] . '</summary>';
}
$output .= '<div class="details-wrapper">';
if (!empty($element['#description'])) {
$output .= '<div class="details-description">' . $element['#description'] . '</div>';
}
$output .= $element['#children'];
if (isset($element['#value'])) {
$output .= $element['#value'];
}
$output .= '</div>';
$output .= "</details>\n";
return $output;
}