Score:0

How to get PHP code into a Views Filter

us flag

I have a text field which is extracted from photo's EXIF value; its value is similar to 2021-05-31T15:15:05.

I want to create a view, use the filter and get the field added in. However, I can't use PHP code for it. Instead, I have to do it manually everyday: Set field_datetime to 05-30 and change it to 05-31 the day after. Is there a way to do it automatically?

I'm using Drupal 8.8.

id flag
Drupal 8 reached end of life in November 2021. Upgrade to Drupal 9.
4uk4 avatar
cn flag
There are two questions. 1. How to get PHP code into a Views Filter? You need a custom views filter plugin. 2. I have to do it manually everyday. Is there a way to do it automatically? Yes, you could save the View config programmatically in a cron job, this also invalidates the cache tag for the View so that it gets re-rendered.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.