0

I would like to implement a hook on a view that grabs the fields that would be displayed and modifies one of the slightly before displaying it. However, I am stuck at the first part which is just finding out how to view/see the fields that I can manipulated. Based on a couple of other post I have read it seems like I should use the parseurl_views_pre_render which seems to make sense. But, I don't even only how to see what the data looks like.

Any pointers or help would be greatly appreciated.

Thanks, Derek

0

I think you can do what you need with hook_views_pre_render.

Here is what you can do to find out what the data you need to manipulate looks like:

  1. Install & enable the devel module - https://drupal.org/project/devel
  2. Create a custom module (if you haven't already)
  3. Add a function based on HOOK_views_pre_render(&$view)
  4. In your function, use the dpm function like so: dpm($view);
  5. Reload the page with the view you want to alter
  6. Explore the data rendered through Krumo which is provided by devel

So, ultimately, your function will start something like this:

function your_module_views_pre_render(&$view) {

  if (($view->name == 'viewname') && ($view->current_display == 'displayname')) {

    dpm($view);
  • Thanks Dave this is very helpful and spot-on the information I needed. – geo derek Nov 21 '13 at 0:50

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.