View source
<?php
namespace Drupal\module_filter\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class ModuleFilterUpdateStatusForm extends FormBase {
public function getFormId() {
return 'module_filter_update_status_form';
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['filters'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'table-filter',
'js-show',
],
],
];
$form['filters']['text'] = [
'#type' => 'search',
'#title' => $this
->t('Filter projects'),
'#title_display' => 'invisible',
'#size' => 30,
'#placeholder' => $this
->t('Filter by name'),
'#attributes' => [
'class' => [
'table-filter-text',
],
'data-table' => '#update-status',
'autocomplete' => 'off',
],
'#attached' => [
'library' => [
'module_filter/update.status',
],
],
];
if (!empty($_GET['filter'])) {
$form['filters']['text']['#default_value'] = $_GET['filter'];
}
$form['filters']['radios'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'module-filter-status',
],
],
'show' => [
'#type' => 'radios',
'#default_value' => 'all',
'#options' => [
'all' => $this
->t('All'),
'updates' => $this
->t('Update available'),
'security' => $this
->t('Security update'),
],
],
];
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}