I am trying to create a custom exposed filter which would be a select field with years (2015-2025). This would filter the result with the year of the date they are created. I followed this tutorial https://www.flocondetoile.fr/blog/filter-content-year-views-drupal-8 But here there is no solution for ajax submission, so the page does not refresh and the filter does not apply.
Currently I have this year as a contextual filter and the form field in the hook_form_views_exposed_form_alter():
$options = [ 'all' => t('- All -'), '2015' => '2015', '2016' => '2016', '2017' => '2017', '2018' => '2018', '2019' => '2019', '2020' => '2020', '2021' => '2021', '2022' => '2022', '2023' => '2023', '2024' => '2024', '2025' => '2025', ]; $form['year'] = [ '#title' => t('By year'), '#type' => 'select', '#options' => $options, '#size' => NULL, '#default_value' => 'all', ];
Is there a possibility for the filter to work with ajax submission?