How do I add view header content in code?
I have seen questions related to this but only where the view is being embedded. I am not embedding any view, but would like to provide content for the view headers in code as I have quite a few views, and I do not want to add the content through the views UI as it is difficult to make changes quickly and as some views have many pages and share the same header.
Currently I have this code.
function MYMODULE_preprocess_views_view(&$vars){
$function = __FUNCTION__ . '_' . $vars['name'];
if (function_exists($function)) {
$function($vars);
}
}
function MYMODULE_preprocess_views_view_VIEW_NAME(&$vars){
// do something here.
$vars['attachment_before'] .= $SOME_CONTENT;
}