Returns HTML to wrap child elements in a container.
Used for grouped form items. Can also be used as a theme wrapper for any renderable element, to surround it with a <div> and add attributes such as classes or an HTML ID.
See the Form API reference for more information on the #theme_wrappers render array property.
$variables: An associative array containing:
function theme_container($variables) {
$element = $variables['element'];
// Ensure #attributes is set.
$element += array(
'#attributes' => array(),
);
// Special handling for form elements.
if (isset($element['#array_parents'])) {
// Assign an html ID.
if (!isset($element['#attributes']['id'])) {
$element['#attributes']['id'] = $element['#id'];
}
// Add the 'form-wrapper' class.
$element['#attributes']['class'][] = 'form-wrapper';
}
return '<div' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</div>';
}