0

I am building a view on my website that lists all currently pending user registrations. (They need to be approved by administrators). I also have a taxonomy that lists 'banned' names. The view lists the users username, email, discord name and twitch handle. I am trying to build a feature that takes any of those fields, and compares them to the 'banned' names list, and if a match is found on any or all of the fields, it adds a special class to the views row.

I can't find the appropriate hook to tie into that allows me to check these values, but also set a new style/class on the row if a match is found. I already have a function that takes the appropriate value and compares it to the taxonomy and returns a result, but I am not sure what hook to place this function in so that I can do if, for example:

MatchFound() goes through each provided value in the array, and if a match is found returns TRUE, or FALSE if not found at all.

$search = ['name','email','discord','twitch'];

if (MatchFound($search)) {
  'return flagged style for row'
}

Is there anybody that could help me?

2
  • 1
    Have you tried template_preprocess_views_view? A preprocess is typically where you'd add classes if you wanted to do it in PHP.
    – sonfd
    Jul 5, 2020 at 17:41
  • This hook appears to be at the individual field element level not at the query result level.
    – Ex0r
    Jul 5, 2020 at 23:38

0

Your Answer

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

Browse other questions tagged or ask your own question.