Details

class Details

Provides a render element for a details element, similar to a fieldset.

Fieldsets can only be used in forms, while details elements can be used outside of forms. Users click on the title to open or close the details element, showing or hiding the contained elements.

Properties:

  • #title: The title of the details container. Defaults to "Details".
  • #open: Indicates whether the container should be open by default. Defaults to FALSE.

Usage example:

$form['author'] = array(
  '#type' => 'details',
  '#title' => $this->t('Author'),
);

$form['author']['name'] = array(
  '#type' => 'textfield',
  '#title' => $this->t('Name'),
);

Plugin annotation

@RenderElement("details")

Hierarchy