1

I have a search result page created using search api and views. My search result page is based on this tutorial and it seems to work properly,however I need to tweak some field's output value and I used hook_views_pre_render to try to alter the field values however I cant see my fields that I added from the views UI interface on the $view->result array but they are rendered on the page. All I see when I krumo($view->result) is (see attached image)enter image description here.

I seem to only get entity and entity_properties array but not the fields in the array. I need to access the field to make the necessary tweaks like we have in the normal $view->result.

1

This is not a specific answer for your situation but I would like to advise you a better way of managing it.

Instead of rendering the views using Fields you can render each row by rendering as Content where you can choose a dedicated View mode which can be easily overridden using the standard template_preprocess_node.

This will bring a lot more flexibility in your Web application.

| improve this answer | |
  • Thanks a million. This was something I was looking for a long time, although I did implement some other way, This will definitely be of use soon. Just FYI i didn't have the rendering option Content but I did have the Rendered entity which could be hooked by preprocess_node for my search api output. – Sanjok Gurung Nov 27 '17 at 12:12

Your Answer

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

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