I want to prevent an attached view from running depending on some coding parameters.
I've tried using hook_views_pre_view()
to prevent it from running, but I can't figure out what options to set on the view to accomplish that. Tweaking attached
or rendered
doesn't seem to do anything.
function ding_eresource_views_pre_view(&$view, &$display_id, &$args) {
if ($view->name == 'eresource_list' && $display_id == 'attachment_1') {
// Prevent rendering if parent view has some option set.
if (!empty($view->old_view[1]->barr)) {
// This does not work. How can it be done?
$view->attached = FALSE;
$view->rendered = TRUE;
}
}
}
How can it be done?