Commit 8c3fe799 authored by Cody Craven's avatar Cody Craven
Browse files

Issue #1274870 by codycraven: Fixed views plugin reporting error when no result.

parent 7130b022
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Taxonomy Display 7.x-1.x, YYYY-MM-DD Taxonomy Display 7.x-1.x, YYYY-MM-DD
------------------------------------ ------------------------------------
Issue #1274870 by codycraven: Fixed views plugin reporting error when no result.
Issue #1261270 by codycraven: Added caching to fetch taxonomy display settings. Issue #1261270 by codycraven: Added caching to fetch taxonomy display settings.
Taxonomy Display 7.x-1.0-rc2, 2011-08-17 Taxonomy Display 7.x-1.0-rc2, 2011-08-17
......
...@@ -27,13 +27,16 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci ...@@ -27,13 +27,16 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci
$build = array(); $build = array();
$embed_view = views_embed_view($options['view'], $options['display'], $term->tid); // The code below essentially mimics views_embed_view() but outputs a
// watchdog error if the view/view display isn't valid.
// TODO: Test the watchdog presents how I'm expecting $view = views_get_view($options['view']);
if (empty($embed_view)) {
// If view/view display isn't valid.
if (!$view || !isset($view->display[$options['display']])) {
watchdog( watchdog(
'taxonomy_display', 'taxonomy_display',
'The view and/or display settings for %vocab are missing, go to the <a href="!link">full display page</a> and reconfigure the taxonomy term\'s associated content display.', 'The view and/or view display for %vocab is missing, go to the <a href="!link">full display page</a> and reconfigure the taxonomy term\'s associated content display.',
array( array(
'%vocab' => $term->vocabulary_machine_name, '%vocab' => $term->vocabulary_machine_name,
'!link' => url('admin/structure/taxonomy/' . $term->vocabulary_machine_name . '/display/full'), '!link' => url('admin/structure/taxonomy/' . $term->vocabulary_machine_name . '/display/full'),
...@@ -41,10 +44,15 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci ...@@ -41,10 +44,15 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci
WATCHDOG_ERROR WATCHDOG_ERROR
); );
} }
else { // Else if the user has access to the view.
$build['view'] = array( elseif ($view->access($options['display'])) {
'#markup' => $embed_view, // Generate the view's output.
); $output = $view->preview($options['display'], $term->tid);
if ($output) {
$build['view'] = array(
'#markup' => $output,
);
}
} }
return $build; return $build;
...@@ -111,10 +119,6 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci ...@@ -111,10 +119,6 @@ class TaxonomyDisplayAssociatedDisplayHandlerViews extends TaxonomyDisplayAssoci
); );
} }
/**
* TODO: Add validate that ensures the display selected is part of the view, necessary for supporting no JS?
*/
/** /**
* We store values to access later for rendering and editing. * We store values to access later for rendering and editing.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment