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?

1 Answer 1


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).

Your Answer

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

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