0

For example, there is a view.

The view has been executed and has results.

How can I alter these results. For example, I need to change the letter "a" to the letter "b" in result of some field.

How can I do it ?

I'm looking into hook_views_pre_render and hook_views_post_render, but can't understand how to get results and how to change them.

Could you share your experience how to do it ? Or could you share useful links ?

  • There are several options, in UI you can rewrite a field and use the replace twig filter, in theming you can use a views field template or in a module you can extend a views field plugin and override render. – 4k4 May 21 '18 at 12:31
  • Can I do it using hook_view_pre_render or hook_view_post_render hooks ? It's more comfortable for my current task. – Yakimkin Roman May 21 '18 at 12:38
  • The comments on the 8.2.x version of the hook_views_pre_render documentation give some examples of how to update field data in hook_view_pre_render. – sonfd May 21 '18 at 15:44

Your Answer

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

Browse other questions tagged or ask your own question.