2012-10-19 20 views
5

Tôi muốn tạo ra một khối, trong đó có các tab $ từ page.tpl.phpTabs trong một khối

/** 
* Implements hook_block_info(). 
*/ 
function mymodule_block_info() { 

    $blocks['tabs'] = array(
    'info' => t('Tabs in block'), 
    'description' => t('blah blah blah'), 
); 
    return $blocks; 
} 


/** 
* Implements hook_block_view(). 
*/ 
function mymodule_block_view($delta = '') { 

    $block = array(); 

    switch ($delta) { 

    case 'tabs': 
     $block['subject'] = t("THIS IS ZHE TABS!"); 
     $block['content'] = array(
     '#theme' => 'menu_local_tasks', 
     '#primary' => menu_local_tasks(0), 
     '#secondary' => menu_local_tasks(1), 
    ); 
    break; 
    } 
    return $block; 
} 



Khối đang được đăng ký một cách chính xác và được hiển thị một cách chính xác với các tab render . Tuy nhiên, Drupal ném rất nhiều lỗi!

Warning: Invalid argument supplied for foreach() in element_children() (line 6300 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Cannot use a scalar value as an array in drupal_render() (line 5767 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Cannot use a scalar value as an array in drupal_render() (line 5822 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Invalid argument supplied for foreach() in element_children() (line 6300 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5767 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5777 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5815 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#printed' in drupal_render() (line 5822 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Invalid argument supplied for foreach() in element_children() (line 6300 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Cannot use a scalar value as an array in drupal_render() (line 5767 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Cannot use a scalar value as an array in drupal_render() (line 5822 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Invalid argument supplied for foreach() in element_children() (line 6300 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5767 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5777 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#children' in drupal_render() (line 5815 of /Users/tolborg/Sites/bibdk/includes/common.inc). 
Warning: Illegal string offset '#printed' in drupal_render() (line 5822 of /Users/tolborg/Sites/bibdk/includes/common.inc). 

Trả lời

0

Có vẻ như vấn đề nằm trong chức năng chủ đề, có thể.

tôi đã cố gắng sử dụng này và nó hoạt động

$tabs = menu_local_tasks(0); 
$block['content'] = $tabs['tabs']['output']; 
0

Có module blockify rằng hoàn thành nhiệm vụ này và việc tạo ra các yếu tố page.tpl.php khác cho bạn. Trang này cũng cung cấp trang quản trị cho các yếu tố để "chặn"

Các vấn đề liên quan