public function FieldFormBase::submitForm in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::submitForm()
- 8.3 src/Form/FieldFormBase.php \Drupal\ds\Form\FieldFormBase::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ConfigFormBase::submitForm
1 call to FieldFormBase::submitForm()
- BlockFieldForm::submitForm in src/
Form/ BlockFieldForm.php - Form submission handler.
2 methods override FieldFormBase::submitForm()
- BlockFieldConfigForm::submitForm in src/
Form/ BlockFieldConfigForm.php - Form submission handler.
- BlockFieldForm::submitForm in src/
Form/ BlockFieldForm.php - Form submission handler.
File
- src/
Form/ FieldFormBase.php, line 159
Class
- FieldFormBase
- Base form for fields.
Namespace
Drupal\ds\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$field = array();
$field['id'] = $form_state
->getValue('id');
$field['label'] = $form_state
->getValue('name');
$field['ui_limit'] = $form_state
->getValue('ui_limit');
$field['properties'] = $this
->getProperties($form_state);
$field['type'] = $this
->getType();
$field['type_label'] = $this
->getTypeLabel();
$entities = $form_state
->getValue('entities');
foreach ($entities as $key => $value) {
if ($key !== $value) {
unset($entities[$key]);
}
}
$field['entities'] = $entities;
// Save field to property.
$this->field = $field;
// Save field values.
$this
->config('ds.field.' . $field['id'])
->setData($field)
->save();
// Clear caches and redirect.
$this
->finishSubmitForm($form, $form_state);
}