public function EntityDisplayFormBase::multistepSubmit in Drupal 10
Same name and namespace in other branches
- 8 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::multistepSubmit()
- 9 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::multistepSubmit()
Form submission handler for multistep buttons.
File
- core/
modules/ field_ui/ src/ Form/ EntityDisplayFormBase.php, line 639
Class
- EntityDisplayFormBase
- Base class for EntityDisplay edit forms.
Namespace
Drupal\field_ui\FormCode
public function multistepSubmit($form, FormStateInterface $form_state) {
$trigger = $form_state
->getTriggeringElement();
$op = $trigger['#op'];
switch ($op) {
case 'edit':
// Store the field whose settings are currently being edited.
$field_name = $trigger['#field_name'];
$form_state
->set('plugin_settings_edit', $field_name);
break;
case 'update':
// Set the field back to 'non edit' mode, and update $this->entity with
// the new settings fro the next rebuild.
$field_name = $trigger['#field_name'];
$form_state
->set('plugin_settings_edit', NULL);
$form_state
->set('plugin_settings_update', $field_name);
$this->entity = $this
->buildEntity($form, $form_state);
break;
case 'cancel':
// Set the field back to 'non edit' mode.
$form_state
->set('plugin_settings_edit', NULL);
break;
case 'refresh_table':
// If the currently edited field is one of the rows to be refreshed, set
// it back to 'non edit' mode.
$updated_rows = explode(' ', $form_state
->getValue('refresh_rows'));
$plugin_settings_edit = $form_state
->get('plugin_settings_edit');
if ($plugin_settings_edit && in_array($plugin_settings_edit, $updated_rows)) {
$form_state
->set('plugin_settings_edit', NULL);
}
break;
}
$form_state
->setRebuild();
}