2012-10-19 5 views
5

ich einen Block erstellen möchten, die die $ Tabs von page.tpl.php enthältTabs in einem Block

/** 
* 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; 
} 



Der Block korrekt registriert wird und korrekt zeigt sich mit den Tabs gemacht . Drupal wirft jedoch viele Fehler auf!

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). 

Antwort

0

Es scheint, das Problem ist in der Thema-Funktion vielleicht.

Ich habe versucht, dies mit und es funktioniert

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

Es ist das Modul blockify, die für Sie diese Aufgabe und die Schaffung anderer page.tpl.php Elemente ergänzt. Es gibt auch der Admin-Seite, für welche Elemente zu "Blockieren"