0

Following this tutorial https://www.drupal.org/node/2481343 i made a filter where the user can select the nodes, createad from a date till now.

Is there an easy way to make a button with 'show nodes from last year'? I was thinking about a button, switchting between 'last year' and 'all' (in fact a reset of the filter).

0

Not very beautiful and dynamic but as a quick fix you could for instance add a Global: Text area to your views. (See screenshot also)

<a href=http://project.local/articles?created%5Bmin%5D=01%2F01%2F2016&created%5Bmax%5D=12%2F31%2F2016>Show nodes from last year</a>
<a href=http://project.local/articles>Show all nodes</a>

To make this more dynamic you could enable the php module (not recommended! https://drupal.stackexchange.com/a/2512/8606) and use date("Y",strtotime("-1 year")); to retrieve the previous year dynamically

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.