2014-02-17 6 views
0

ct 모달 창에서 패널 (node_view)을로드합니다. 지금까지 완벽하게 작동합니다. 하지만 지금은 패널의 특정 변형을로드해야합니다.프로그래밍 방식으로 패널 변형을로드하는 방법은 무엇입니까?

나는 핸들러를 가지고 놀고 있었지만 아직 얻지 못했습니다.

어떻게하면됩니까?

여기 programmactically 패널을로드하는 내 코드입니다 :

function get_panel_view(&$node) { 
    // Load my task plugin 
    $task = page_manager_get_task('node_view'); 

    // Load the node into a context. 
    ctools_include('context'); 
    ctools_include('context-task-handler'); 

    $contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); 

    $output = ctools_context_handler_render($task, '', $contexts, array($node->nid)); 
    if ($output !== FALSE) { 
     return $output; 
     //return drupal_render($output['content']); 
    } 
    // Otherwise, fall back. 
    return drupal_render(node_view(node_load($node->nid))); 
} 

답변

2

기능 ctools_context_handler_render_handler()는 않습니다 당신은 주어진 패널, 예를 들어, 모든 핸들러 객체를 얻을 필요가, 예컨대 :

  1. 먼저 트릭

    $handlers = page_manager_load_sorted_handlers($task, '', TRUE); 
    
  2. 표시 할 처리기 (변형)를 지정하십시오. 이제 $output 내 패널의 변형 (3)를 포함

    $output = ctools_context_handler_render_handler($task,'',$handler, $contexts, array($node->nid)); 
    

그리고 :

$handler = $handlers['node_view_panel_context_3']; 
  • 이제 우리는 필요한 모든있어 인수는 기능을 발사합니다.