2

I have a view where the user can filter by using contextual filters in the URL, like this:

timeline/%year/%month/%day

I then use these contextual filters:

Content: node.field_daterange (year)

Content: node.field_daterange (month)

Content: node.field_daterange (day)

Users can use this path to get all events in a year, e.g:

timeline/1945

Or to get all events on a specific month in a year they can use

timeline/1945/05

Now I want to dynamically build the title of the view. If only the year parameter is used it should the title "Timeline YEAR" and if both year and month is set I want it to have title "Timeline MONTH YEAR".

In the contextual filter, there is an alternative named "Override title" (under the box "When the filter value IS in the URL or a default is provided")

It is written "Override the view and other argument titles. You may use Twig syntax in this field." But how can I now catch back the %year, %month or %day argument to use it in the title?

1
  • 1
    There is a Replacement patterns fieldset below it that you can copy the patterns from. You need to edit each contextual filter and override the title with the pattern that makes sense in each of those contexts.
    – prkos
    Nov 12, 2018 at 0:28

1 Answer 1

5

There is a Replacement patterns fieldset below it that you can copy the patterns from. You need to edit each contextual filter and override the title with the pattern that makes sense in each of those contexts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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