diff --git a/includes/context-task-handler.inc b/includes/context-task-handler.inc index e1f7861..d411d6e 100644 --- a/includes/context-task-handler.inc +++ b/includes/context-task-handler.inc @@ -180,36 +180,6 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte } /** - * Called to execute actions that should happen before a handler is rendered. - */ -function ctools_context_handler_pre_render($handler, $contexts, $args) { - $plugin = page_manager_get_task_handler($handler->handler); - - if (user_access('administer page manager') && isset($handler->task)) { - // Provide a tab to edit this context: - ctools_include('menu'); - $task = page_manager_get_task($handler->task); - - $title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array('@type' => $plugin['title'])); - $trail = array(); - if (!empty($plugin['tab operation'])) { - if (is_array($plugin['tab operation'])) { - $trail = $plugin['tab operation']; - } - else if (function_exists($plugin['tab operation'])) { - $trail = $plugin['tab operation']($handler, $contexts, $args); - } - } - - ctools_menu_add_tab(array( - 'title' => $title, - 'href' => page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail), - 'type' => MENU_LOCAL_ACTION - )); - } -} - -/** * Compare arguments to contexts for selection purposes. * * @param $handler diff --git a/page_manager/plugins/task_handlers/http_response.inc b/page_manager/plugins/task_handlers/http_response.inc index ba549b4..fe0fcad 100644 --- a/page_manager/plugins/task_handlers/http_response.inc +++ b/page_manager/plugins/task_handlers/http_response.inc @@ -261,10 +261,6 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes return; } - if (isset($handler->handler)) { - ctools_context_handler_pre_render($handler, $contexts, $args); - } - $info['response code'] = $handler->conf['code']; if ($info['response code'] == 301) { $path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts); diff --git a/page_manager/plugins/tasks/page.inc b/page_manager/plugins/tasks/page.inc index aba99c7..b0d3136 100644 --- a/page_manager/plugins/tasks/page.inc +++ b/page_manager/plugins/tasks/page.inc @@ -324,6 +324,42 @@ function page_manager_page_execute($subtask_id) { return drupal_not_found(); } + // Add contextual links to edit the panel page. + if (module_exists('contextual') && user_access('access contextual links') && user_access('administer page manager')) { + $trail = array(); + if (!empty($task['tab operation'])) { + if (is_array($task['tab operation'])) { + $trail = $task['tab operation']; + } + else if (function_exists($task['tab operation'])) { + $trail = $task['tab operation']($page, $contexts, $args); + } + } + + $links = array(array( + 'title' => t('Edit Panel'), + 'href' => page_manager_edit_url(page_manager_make_task_name($page->task, $subtask_id), $trail), + )); + $build = array( + '#theme_wrappers' => array('container'), + '#attributes' => array('class' => array('contextual-links-region')), + ); + $build['content'] = array( + '#markup' => $output, + ); + $build['contextual_links'] = array( + '#prefix' => '', + '#theme' => 'links__contextual', + '#links' => $links, + '#attributes' => array('class' => array('contextual-links')), + '#attached' => array( + 'library' => array(array('contextual', 'contextual-links')), + ), + ); + $output = $build; + } + return $output; }