public function Tab::settingsForm in Field Group 8
Same name and namespace in other branches
- 8.3 src/Plugin/field_group/FieldGroupFormatter/Tab.php \Drupal\field_group\Plugin\field_group\FieldGroupFormatter\Tab::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/ Tab.php, line 76
Class
- Tab
- Plugin implementation of the 'tab' formatter.
Namespace
Drupal\field_group\Plugin\field_group\FieldGroupFormatterCode
public function settingsForm() {
$form = parent::settingsForm();
$form['formatter'] = array(
'#title' => $this
->t('Default state'),
'#type' => 'select',
'#options' => array_combine($this->pluginDefinition['format_types'], $this->pluginDefinition['format_types']),
'#default_value' => $this
->getSetting('formatter'),
'#weight' => -4,
);
$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;
}