From 2823a1b1e745650b3cbf4641a30eb92a4477eda4 Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Thu, 24 May 2012 16:08:54 -0500 Subject: [PATCH] Issue #1287166: Contextual Links for Views on My Workbench page --- workbench.pages.inc | 5 +++++ workbench.theme.inc | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/workbench.pages.inc b/workbench.pages.inc index 0769847..f35d068 100644 --- a/workbench.pages.inc +++ b/workbench.pages.inc @@ -56,6 +56,11 @@ function workbench_content() { if (isset($output[$key]['#view']) && $view = views_get_view($output[$key]['#view'])) { $output[$key] += array('#markup' => '', '#view_display' => 'default'); $display_id = $output[$key]['#view_display']; + + // Build contextual links. + $output[$key] += contextual_element_info(); + views_add_contextual_links($output[$key]['contextual_links'], 'block', $view, $display_id); + if ($view->access($display_id)) { $output[$key]['#markup'] .= $view->preview($display_id, array()); if ($title = $view->get_title()) { diff --git a/workbench.theme.inc b/workbench.theme.inc index 8798c70..aadc521 100644 --- a/workbench.theme.inc +++ b/workbench.theme.inc @@ -19,6 +19,12 @@ function theme_workbench_element($variables) { $title = '

' . check_plain($element['#title']) . '

'; } + $contextual = ''; + if (!empty($element['contextual_links'])) { + $contextual = drupal_render($element['contextual_links']); + $element['#attributes']['class'][] = 'contextual-links-region'; + } + // Use #attributes to customize a wrapper
. $attributes = ''; if (!empty($element['#attributes'])) { @@ -31,6 +37,6 @@ function theme_workbench_element($variables) { } // Build simple output. - $output = "{$title}{$element['#children']}
"; + $output = "{$title}{$contextual}{$element['#children']}"; return $output; } -- 1.7.2.5