public function FieldFormButtonTest::viewsFormSubmit in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php \Drupal\views_test_data\Plugin\views\field\FieldFormButtonTest::viewsFormSubmit()
Submit handler for the views form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ field/ FieldFormButtonTest.php, line 66
Class
- FieldFormButtonTest
- A handler to provide a field that is completely custom by the administrator.
Namespace
Drupal\views_test_data\Plugin\views\fieldCode
public function viewsFormSubmit(&$form, FormStateInterface $form_state) {
$triggering_element = $form_state
->getTriggeringElement();
if (!empty($triggering_element['#test_button'])) {
$row_index = $triggering_element['#row_index'];
$view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this
->t('no arguments');
$this
->messenger()
->addStatus($this
->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
'@display' => $this->view->current_display,
'@view_id' => $this->view
->id(),
'@args' => $view_args,
'@row_index' => $row_index,
]));
}
}