You are here

public function Details::settingsForm in Field Group 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/field_group/FieldGroupFormatter/Details.php \Drupal\field_group\Plugin\field_group\FieldGroupFormatter\Details::settingsForm()

Returns a form to configure settings for the formatter.

Invoked in field_group_field_ui_display_form_alter to allow administrators to configure the formatter. The field_group module takes care of handling submitted form values.

Return value

array The form elements for the formatter settings.

Overrides FieldGroupFormatterBase::settingsForm

File

src/Plugin/field_group/FieldGroupFormatter/Details.php, line 61

Class

Details
Details element.

Namespace

Drupal\field_group\Plugin\field_group\FieldGroupFormatter

Code

public function settingsForm() {
  $form = parent::settingsForm();
  $form['open'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display element open by default.'),
    '#default_value' => $this
      ->getSetting('open'),
  );
  if ($this->context == 'form') {
    $form['required_fields'] = array(
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Mark group as required if it contains required fields.'),
      '#default_value' => $this
        ->getSetting('required_fields'),
      '#weight' => 2,
    );
  }
  return $form;
}