function theme_container

7.x form.inc theme_container($variables)

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.

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #id, #attributes, #children.

Related topics

23 string references to the theme hook from theme_container()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

authorize_filetransfer_form in drupal/includes/authorize.inc
Form constructor for the file transfer authorization form.
drupal_common_theme in drupal/includes/common.inc
Provides theme registration for themes across .inc files.
field_default_form in drupal/modules/field/field.form.inc
Creates a form element for a field and can populate it with a default value.
field_ui_display_overview_form in drupal/modules/field_ui/field_ui.admin.inc
Form constructor for the field display settings for a given view mode.
filter_process_format in drupal/modules/filter/filter.module
Expands an element into a base element with text format selector attached.

... See full list

File

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

Code

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>';
}