class Fieldgroup

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Render/Element/Fieldgroup.php \Drupal\Core\Render\Element\Fieldgroup
  2. 10 core/lib/Drupal/Core/Render/Element/Fieldgroup.php \Drupal\Core\Render\Element\Fieldgroup
  3. 9 core/lib/Drupal/Core/Render/Element/Fieldgroup.php \Drupal\Core\Render\Element\Fieldgroup
  4. 8.9.x core/lib/Drupal/Core/Render/Element/Fieldgroup.php \Drupal\Core\Render\Element\Fieldgroup

Provides a render element for a group of form elements.

In default rendering, the only difference between a 'fieldgroup' and a 'fieldset' is the CSS class applied to the containing HTML element. Normally use a fieldset.

Attributes

#[RenderElement('fieldgroup')]

Hierarchy

Expanded class hierarchy of Fieldgroup

Deprecated

in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal\Core\Render\Element\Fieldset instead.

See also

\Drupal\Core\Render\Element\Fieldset for documentation and usage.

\Drupal\Core\Render\Element\Fieldset

\Drupal\Core\Render\Element\Details

https://www.drupal.org/node/3515272

8 string references to 'Fieldgroup'
CompositeFormElementTrait::preRenderCompositeFormElement in core/lib/Drupal/Core/Render/Element/CompositeFormElementTrait.php
Adds form element theming to an element if its title or description is set.
Fieldgroup::getInfo in core/lib/Drupal/Core/Render/Element/Fieldgroup.php
FieldStorageConfigEditForm::getCardinalityForm in core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php
Builds the cardinality form.
MultilingualReviewPageTest::getAvailablePaths in core/modules/contact/tests/src/Functional/migrate_drupal_ui/d6/MultilingualReviewPageTest.php
Gets the available upgrade paths.
MultilingualReviewPageTest::getAvailablePaths in core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php

... See full list

File

core/lib/Drupal/Core/Render/Element/Fieldgroup.php, line 24

Namespace

Drupal\Core\Render\Element
View source
class Fieldgroup extends Fieldset {
  
  /**
   * {@inheritdoc}
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    @trigger_error('The ' . __CLASS__ . ' element is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use ' . Fieldset::class . ' instead. See https://www.drupal.org/node/3515272', E_USER_DEPRECATED);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getInfo() {
    $info = parent::getInfo();
    $info['#attributes']['class'] = [
      'fieldgroup',
    ];
    $info['#pre_render'][] = [
      static::class,
      'preRenderAttachments',
    ];
    return $info;
  }
  
  /**
   * Adds the fieldgroup library.
   */
  public static function preRenderAttachments($element) : array {
    $element['#attached']['library'][] = 'core/drupal.fieldgroup';
    return $element;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.