function form_pre_render_details

Adds form element theming to details.

Parameters

$element: An associative array containing the properties and children of the details.

Return value

The modified element.

Related topics

1 string reference to 'form_pre_render_details'
system_element_info in drupal/core/modules/system/system.module
Implements hook_element_info().

File

drupal/core/includes/form.inc, line 3924
Functions for form and batch generation and processing.

Code

function form_pre_render_details($element) {

  // The .form-wrapper class is required for #states to treat details like
  // containers.
  if (!isset($element['#attributes']['class'])) {
    $element['#attributes']['class'] = array();
  }

  // Collapsible details.
  $element['#attached']['library'][] = array(
    'system',
    'drupal.collapse',
  );
  if (empty($element['#collapsed'])) {
    $element['#attributes']['open'] = 'open';
  }
  return $element;
}