function MessageForm::submitForm

Same name and namespace in other branches
  1. 11.x core/modules/migrate/src/Form/MessageForm.php \Drupal\migrate\Form\MessageForm::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 FormInterface::submitForm

File

core/modules/migrate/src/Form/MessageForm.php, line 82

Class

MessageForm
Migrate messages form.

Namespace

Drupal\migrate\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $filters['message'] = [
    'title' => $this->t('message'),
    'where' => 'msg.message LIKE ?',
    'type' => 'string',
  ];
  $filters['severity'] = [
    'title' => $this->t('Severity'),
    'where' => 'msg.level = ?',
    'type' => 'array',
  ];
  $session_filters = $this->getRequest()
    ->getSession()
    ->get('migration_messages_overview_filter', []);
  foreach ($filters as $name => $filter) {
    if ($form_state->hasValue($name)) {
      $session_filters[$name] = [
        'where' => $filter['where'],
        'value' => $form_state->getValue($name),
        'type' => $filter['type'],
      ];
    }
  }
  $this->getRequest()
    ->getSession()
    ->set('migration_messages_overview_filter', $session_filters);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.