You are here

public function WebformSubmissionNotesEditField::viewsFormSubmit in Webform Views Integration 8.5

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

src/Plugin/views/field/WebformSubmissionNotesEditField.php, line 64

Class

WebformSubmissionNotesEditField
Webform submission notes field that allows to edit them.

Namespace

Drupal\webform_views\Plugin\views\field

Code

public function viewsFormSubmit(&$form, FormStateInterface $form_state) {
  foreach ($this->view->result as $row_index => $row) {

    /** @var WebformSubmissionInterface $webform_submission */
    $webform_submission = $this
      ->getEntity($row);
    $notes = $form_state
      ->getValue($form[$this->options['id']][$row_index]['#parents']);
    if ($webform_submission
      ->getNotes() != $notes) {
      $webform_submission
        ->setNotes($notes);
      $webform_submission
        ->save();
    }
  }
}