From 169a8c126c32ec212d713222b66fad5611bae3ae Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 24 Apr 2012 10:52:29 +0900 Subject: [PATCH] Issue #857124 by lucascaro, Alan D., 30equals, tim.plunkett: Fixed Collapsible fieldsets and vertical tabs do not work without form_builder() (Form API). --- core/includes/form.inc | 28 +++++++++++++-------------- core/modules/system/tests/common.test | 9 +++++++++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/core/includes/form.inc b/core/includes/form.inc index b5a13c55f0fe..6d93420ceedf 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -3597,6 +3597,20 @@ function form_process_fieldset(&$element, &$form_state) { // Contains form element summary functionalities. $element['#attached']['library'][] = array('system', 'drupal.form'); + return $element; +} + +/** + * Adds members of this group as actual elements for rendering. + * + * @param $element + * An associative array containing the properties and children of the + * fieldset. + * + * @return + * The modified element with all group members. + */ +function form_pre_render_fieldset($element) { // The .form-wrapper class is required for #states to treat fieldsets like // containers. if (!isset($element['#attributes']['class'])) { @@ -3612,20 +3626,6 @@ function form_process_fieldset(&$element, &$form_state) { } } - return $element; -} - -/** - * Adds members of this group as actual elements for rendering. - * - * @param $element - * An associative array containing the properties and children of the - * fieldset. - * - * @return - * The modified element with all group members. - */ -function form_pre_render_fieldset($element) { // Fieldsets may be rendered outside of a Form API context. if (!isset($element['#parents']) || !isset($element['#groups'])) { return $element; diff --git a/core/modules/system/tests/common.test b/core/modules/system/tests/common.test index cc51a017ec5f..0380b6ebb446 100644 --- a/core/modules/system/tests/common.test +++ b/core/modules/system/tests/common.test @@ -1821,6 +1821,15 @@ class CommonDrupalRenderTestCase extends DrupalWebTestCase { ':title' => $element['#title'], )); + $element = array( + '#type' => 'fieldset', + '#title' => $this->randomName(), + '#collapsible' => TRUE, + ); + $this->assertRenderedElement($element, '//fieldset[contains(@class, :class)]', array( + ':class' => 'collapsible', + )); + $element['item'] = array( '#type' => 'item', '#title' => $this->randomName(), -- GitLab