Skip to main content

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(&$view, &$display_id, &$args) {
  if ($view->name == 'VIEW_NAME' && $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->display_handler->options['footer']['DISPLAY_NAME']['FIELD_NAME']);

    $view->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->set_item_option($display_id, 'footer', 'DISPLAY_NAME', 'view_to_insert', '');
    // For the normal text area display you do like this:
    $view->set_item_option($display_id, 'footer', 'DISPLAY_NAME', 'content', '');
  }
}
Nikit
  • 4k
  • 1
  • 20
  • 27