0

I'm pretty new to Drupal and I'm also pretty sure this is a noob question.

I'm trying to build my theme, and in particular I'm trying to manipulate node output to the page, before using the View I simply implemented myTheme_preprocess_page hook and got the content doing $nodes = $variables['page']['content']['system_main']['nodes'];. From that I made all the needed modification.

Now, I want to order the node using the modification date (or whatever parameter) and the View module seems to do just what I want. The problem is now that in my preprocess_page hook I don't have an array of nodes, but all the markup coming from the node.tpl.php file (with missing field of course, because I haven't had the chance to make modification to the output), e.g. insted of $variables['page']['content']['system_main']['nodes'] I have $variables['page']['content']['system_main']['main']['#markup'].

What am I missing? Shouldn't the preprocess_page function return the nodes fro the database (as it did without using View) instead of the markup? Is there another hook I don't know about that allows me to do my preprocessing stuff?

1

If you want to access modify date and render data so you can use hook_views_pre_render(&$view) $view->result to access result nodes.

and you want to change query condition the you can use hook_views_query_alter(&$view, &$query)

| improve this answer | |

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.