1

I have a view which, in addition to showing event nodes, also shows "fake" event nodes. The "fake" event nodes are inserted in hook_views_pre_render().

The view also has an exposed filter to filter out content tagged with a certain term ID on the event_type field. The exposed filter list has gotten too large so now it would make sense to only show the terms in the list that can filter out the view results (including the "fake" events).

Now I tried this with hook_form_alter(), but the problem is that the "fake" event nodes aren't available by using views_get_view_result() and I'm not sure what other function could be used to do that here.

I tried using dpm($view); in hook_views_pre_render(), hook_views_pre_build(), and hook_views_pre_view(), but I could not find how to change values in the exposed filter in any of those.

Where can I see the values of the view result at the same time as the value options in the exposed filter?

1
  • Dunno if I understand your problem well, but maybe pure frontend filtering will be ok for your needs?
    – Codium
    Commented Nov 5, 2015 at 17:49

1 Answer 1

-1

Here is sample exposed filters form altering: http://www.tylerfrankenstein.com/code/drupal-alter-views-exposed-filter-form

Maybe you can call a function which returns fake nodes twice?

So in hook_views_pre_render():

$fake_events = get_fake_events();
add_fake_events_to_rows($view->result);

and calling it in hook_form_alter() too:

$fake_events = get_fake_events();

Any problems with working that way?

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.