In Drupal 6, a menu callback needs to return a string that contains the HTML to output together the output of other modules; alternatively, it can print the output and call exit()
.
If you need to pass an array to a theme function, then the output returned from the menu callback should be output from a theme function to which the menu callback passes an array.
function pcb_exe($id) {
$ar = array('arg1'=> 'value1', 'arg2'=> $id);
return theme('pcb_exe_output', $ar);
}
In Drupal 7 (and higher versions), the output of a menu callback is normally an array that has the format used by drupal_render().
It still possible to pass an array to a theme function, but the parameters passed to a theme function changed.
function pcb_exe($id) {
$ar = array('arg1'=> 'value1', 'arg2'=> $id);
return theme('pcb_exe_output', $ar);
}
In this case, there is no noticeable difference, as the parameter passed to the theme function was already an array.
The parameter passed to a theme function since Drupal 7 is an array containing all the values required from the theme function. See the code of theme_vertical_tabs() as example:
function theme_vertical_tabs($variables) {
$element = $variables['element'];
// Add required JavaScript and Stylesheet.
drupal_add_library('system', 'drupal.vertical-tabs');
$output = '<h2 class="element-invisible">' . t('Vertical Tabs') . '</h2>';
$output .= '<div class="vertical-tabs-panes">' . $element['#children'] . '</div>';
return $output;
}