TransWikia.com

How to alter node body content through Views pre render hook?

Drupal Answers Asked by pramodg on November 11, 2021

I have build the view to display node title and node body also I have applied combined fields filter which searches the keyword in title and body and returns the results.

While rendering the contents I have to render the title and body with the highlighted keywords that are been searched.

Currently I am using hook_views_pre_render to alter the same.But unable to replace the body text with my generated results.

How can I alter the body contents?

One Answer

What variable are you modifying? When I modify Views results I usually use hook_views_post_execute. I then modify the appropriate element in $view->result. You may be able to do the same from hook_views_pre_render (I don't use that one often especially in this type of case).

Answered by sareed on November 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP