Typo3 News Extension Filter Custom Field

114 Views Asked by At

I use the news extension and have followed this instruction for creating a custom field to the news: https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/ExtendNews/ProxyClassGenerator/Index.html

Now i want to add a select filter to my /Template/Category/List.html that filters the news list by the selected id.

<form action="{f:uri.page(pageUid: '{settings.listPid}')}" method="get" id="filterForm">
   <div class="row gy-3">
    <div class="col-12 col-lg-4">
        <select class="form-select ww-select gemeinde w-100" aria-label="select-example-lg" name="gemeinde">
           <option value="0">Gemeinde</option>
                   <f:for each="{gemeinden}" as="gemeinde">
                       <option value="{gemeinde.uid}">{gemeinde.title}</option>
                   </f:for>
        </select>

    <div class="d-flex justify-content-center mt-5">
        <button class="btn btn-primary" type="submit" >Jetzt suchen</button>
    </div>
                            
    </div>
</form>

Unfortunately i cant find anything on the internet on how to do this.

I have tried some "solutions" by ChatGpt but nothing seemed to work.

1

There are 1 best solutions below

0
Bernd Wilke πφ On

If you want to use your own field it could get difficult as you need to insert the new field to any queries.

I would suggest to use categories (just insert your options as categories).

Then you can use the build in filters for categories including the option to show all categories and show only categories from the selected one. Therefore look for the configuration regarding overwriteDemand. You even can select multiple categories as shown in the example in the manual