function TableDragTestForm::submitForm
Same name in other branches
- 8.9.x core/modules/system/tests/modules/tabledrag_test/src/Form/TableDragTestForm.php \Drupal\tabledrag_test\Form\TableDragTestForm::submitForm()
- 10 core/modules/system/tests/modules/tabledrag_test/src/Form/TableDragTestForm.php \Drupal\tabledrag_test\Form\TableDragTestForm::submitForm()
- 11.x core/modules/system/tests/modules/tabledrag_test/src/Form/TableDragTestForm.php \Drupal\tabledrag_test\Form\TableDragTestForm::submitForm()
Overrides FormInterface::submitForm
File
-
core/
modules/ system/ tests/ modules/ tabledrag_test/ src/ Form/ TableDragTestForm.php, line 183
Class
- TableDragTestForm
- Provides a form for draggable table testing.
Namespace
Drupal\tabledrag_test\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$operation = isset($form_state->getTriggeringElement()['#op']) ? $form_state->getTriggeringElement()['#op'] : 'save';
switch ($operation) {
case 'reset':
$this->state
->set('tabledrag_test_table', array_flip(range(1, 5)));
break;
default:
$test_table = [];
foreach ($form_state->getValue('table') as $row) {
$test_table[$row['id']] = $row;
}
$this->state
->set('tabledrag_test_table', $test_table);
break;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.