diff --git a/core/lib/Drupal/Core/Render/Element/Container.php b/core/lib/Drupal/Core/Render/Element/Container.php index 4703c40..23f951a 100644 --- a/core/lib/Drupal/Core/Render/Element/Container.php +++ b/core/lib/Drupal/Core/Render/Element/Container.php @@ -13,8 +13,8 @@ * an HTML ID. * * Properties: - * - #optional: Indicates whether the container should not render when it has - * no visible children. Defaults to FALSE. + * - #optional: Indicates whether the container should render when it has no + * visible children. Defaults to FALSE. * * Usage example: * @code diff --git a/core/modules/system/tests/modules/form_test/src/Form/FormTestOptionalContainerForm.php b/core/modules/system/tests/modules/form_test/src/Form/FormTestOptionalContainerForm.php index 4f60771..7cacf2e 100644 --- a/core/modules/system/tests/modules/form_test/src/Form/FormTestOptionalContainerForm.php +++ b/core/modules/system/tests/modules/form_test/src/Form/FormTestOptionalContainerForm.php @@ -38,14 +38,15 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'container', '#attributes' => ['class' => ['nonempty_optional']], '#optional' => TRUE, - 'child' => [], ]; + $form['nonempty_optional']['child_1'] = []; + $form['nonempty_nonoptional'] = [ '#type' => 'container', '#attributes' => ['class' => ['nonempty_nonoptional']], '#optional' => FALSE, - 'child' => [], ]; + $form['nonempty_nonoptional']['child_2'] = []; return $form; }