Useful to collect later in other views hooks so you can alter the view based on where it came from
patch attached

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

galooph’s picture

The patch has a slight flaw.

Here's the post-patched code:

// Render the view like Views would do.
// @see views_embed_view()
$view = views_get_view($view_name);
// Embed the original element into the view so you can pick it up later if needed
$view->viewfield = $element;
if ($view && $view->access($display)) {

views_get_view() will return empty if the view doesn't exist. If this happens, then $view->viewfield = $element; will instantiate $view as a standard object. At this point, the first part of the if ($view && $view->access($display)) if statement passes, but as a standard object has no access method, PHP throws a fatal error.

I've attached a revised patch where the $view->viewfield = $element; line is moved inside the if ($view && $view->access($display)) statement.

jerdavis’s picture

Status: Needs review » Closed (won't fix)

Closing issue as Drupal 6 is no longer actively supported.