function MessageForm::buildForm
Same name in other branches
- 11.x core/modules/migrate/src/Form/MessageForm.php \Drupal\migrate\Form\MessageForm::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ migrate/ src/ Form/ MessageForm.php, line 36
Class
- MessageForm
- Migrate messages form.
Namespace
Drupal\migrate\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$session_filters = $this->getRequest()
->getSession()
->get('migration_messages_overview_filter', []);
$form['filters'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this->t('Filter messages'),
'#weight' => 0,
];
$form['filters']['message'] = [
'#type' => 'textfield',
'#title' => $this->t('Message'),
'#default_value' => $session_filters['message']['value'] ?? '',
];
$form['filters']['severity'] = [
'#type' => 'select',
'#title' => $this->t('Severity level'),
'#default_value' => $session_filters['severity']['value'] ?? [],
'#options' => [
MigrationInterface::MESSAGE_ERROR => $this->t('Error'),
MigrationInterface::MESSAGE_WARNING => $this->t('Warning'),
MigrationInterface::MESSAGE_NOTICE => $this->t('Notice'),
MigrationInterface::MESSAGE_INFORMATIONAL => $this->t('Info'),
],
'#multiple' => TRUE,
'#size' => 4,
];
$form['filters']['actions'] = [
'#type' => 'actions',
'#attributes' => [
'class' => [
'container-inline',
],
],
];
$form['filters']['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Filter'),
];
$form['filters']['actions']['reset'] = [
'#type' => 'submit',
'#value' => $this->t('Reset'),
'#submit' => [
'::resetForm',
],
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.