You are here

public function Fieldset::settingsForm in Field Group 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/field_group/FieldGroupFormatter/Fieldset.php \Drupal\field_group\Plugin\field_group\FieldGroupFormatter\Fieldset::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/Fieldset.php, line 65

Class

Fieldset
Plugin implementation of the 'fieldset' formatter.

Namespace

Drupal\field_group\Plugin\field_group\FieldGroupFormatter

Code

public function settingsForm() {
  $form = parent::settingsForm();
  $form['description'] = array(
    '#title' => $this
      ->t('Description'),
    '#type' => 'textarea',
    '#default_value' => $this
      ->getSetting('description'),
    '#weight' => -4,
  );
  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;
}