Views 3 | How to programatically unset or add new value to a view's footer / header display? I have added 1 view display into my view's footer via "Global: View area | The view to insert into this area." and a regular "Global: Text area".

So my view has 2 footer displays, one being another view display and the other a normal text area.

Now I want to unset/hide either one of the footer display based on a condition, perhaps via hook_views_pre_render()

I was expecting to find documentation on something like:

$view-&gt;display['MY_VIEW_DISPLAY_ID']-&gt;handler-&gt;handlers['footer']['FOOTER_DISPLAY_ID']-&gt;unset_display();


But obviously that is not the way to go. Is it possible to accomplish that via hook_views_pre_render() or any other means? If so, how?
The snap code below has been tested only on D7. In case this code does not work on D6, check out the comments on this post here.

function MYMODULE_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  if ($view-&gt;name == 'VIEW_NAME' &amp;&amp; $display_id == 'DISPLAY_ID') {

    // To find out the DISPLAY_NAME, FIELD_NAME and FIELD_VALUE use the devel module function
    // below to print them out.
    // Replacing 'footer' by 'header' works the same way.
    dpm($view-&gt;display_handler-&gt;options['footer']['DISPLAY_NAME']['FIELD_NAME']);

    $view-&gt;set_item_option($display_id, 'footer', 'DISPLAY_NAME', 'FIELD_NAME', 'FIELD_VALUE');

    // In this case scenario you needed to unset the footer display.
    // For the embedded view display you do like this:
    $view-&gt;set_item_option($display_id, 'footer', 'DISPLAY_NAME', 'view_to_insert', '');
    // For the normal text area display you do like this:
    $view-&gt;set_item_option($display_id, 'footer', 'DISPLAY_NAME', 'content', '');
  }
}




Due to comments, to determine what views name and display came to this function, make next (of course, "devel" module should be enabled)

    function MYMODULE_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
      dsm($view-&gt;name);
      dsm($display_id);
      if ($view-&gt;name == 'VIEW_NAME' &amp;&amp; $display_id == 'DISPLAY_ID') {
...
      }
    }


And update views page.