public function ContentLogFilterForm::buildForm in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/Form/ContentLogFilterForm.php \Drupal\content_sync\Form\ContentLogFilterForm::buildForm()
- 8 src/Form/ContentLogFilterForm.php \Drupal\content_sync\Form\ContentLogFilterForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ ContentLogFilterForm.php, line 23
Class
- ContentLogFilterForm
- Provides the database logging filter form.
Namespace
Drupal\content_sync\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
//$filters = cs_log_filters();
$form['filters'] = [
'#type' => 'details',
'#title' => $this
->t('Filter log messages'),
'#open' => TRUE,
];
foreach ($filters as $key => $filter) {
$form['filters']['status'][$key] = [
'#title' => $filter['title'],
'#type' => 'select',
'#multiple' => TRUE,
'#size' => 8,
'#options' => $filter['options'],
];
if (!empty($_SESSION['cs_log_overview_filter'][$key])) {
$form['filters']['status'][$key]['#default_value'] = $_SESSION['blog_overview_filter'][$key];
}
}
$form['filters']['actions'] = [
'#type' => 'actions',
'#attributes' => [
'class' => [
'container-inline',
],
],
];
$form['filters']['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Filter'),
];
if (!empty($_SESSION['cs_log_overview_filter'])) {
$form['filters']['actions']['reset'] = [
'#type' => 'submit',
'#value' => $this
->t('Reset'),
'#limit_validation_errors' => [],
'#submit' => [
'::resetForm',
],
];
}
return $form;
}