3 namespace Drupal\webprofiler\Form;
5 use Drupal\Core\Form\FormBase;
6 use Drupal\Core\Form\FormStateInterface;
10 * Class ProfilesFilterForm
12 class ProfilesFilterForm extends FormBase {
17 public function getFormId() {
18 return 'webprofiler_profiles_filter';
24 public function buildForm(array $form, FormStateInterface $form_state) {
26 '#type' => 'textfield',
27 '#title' => $this->t('IP'),
29 '#default_value' => $this->getRequest()->query->get('ip'),
30 '#prefix' => '<div class="form--inline clearfix">',
34 '#type' => 'textfield',
35 '#title' => $this->t('Url'),
37 '#default_value' => $this->getRequest()->query->get('url'),
42 '#title' => $this->t('Method'),
43 '#options' => ['GET' => 'GET', 'POST' => 'POST'],
44 '#default_value' => $this->getRequest()->query->get('method'),
47 $limits = [10, 50, 100];
50 '#title' => $this->t('Limit'),
51 '#options' => array_combine($limits, $limits),
52 '#default_value' => $this->getRequest()->query->get('limit'),
55 $form['actions'] = ['#type' => 'actions'];
56 $form['actions']['filter'] = [
58 '#value' => t('Filter'),
59 '#attributes' => ['class' => ['button--primary']],
60 '#suffix' => '</div>',
69 public function submitForm(array &$form, FormStateInterface $form_state) {
70 $ip = $form_state->getValue('ip');// ['values']['ip'];
71 $url = $form_state->getValue('url');
72 $method = $form_state->getValue('method');
73 $limit = $form_state->getValue('limit');
75 $url = new Url('webprofiler.admin_list', [], [
84 $form_state->setRedirectUrl($url);