Hi

I'm having some problems building the menu.
This is my code, but the only result I'm getting is "Array".
What am I doing wrong?

<?php

/**
* Implementation of hook_perm().
*/
function check_perm() {
return array('list flavors', 'add flavor');
}

/**
* Implementation of hook_menu().
*/
function check_menu() {
$items['check'] = array(
'title' => 'check flavors',
'access arguments' => array('list flavors'),
'page callback' => 'check_overview',
'type' => MENU_NORMAL_ITEM,
);

$items['check/list'] = array(
'title' => 'List flavors',
'access arguments' => array('list flavors'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);

$items['check/add'] = array(
'title' => 'Add flavor',
'access arguments' => array('add flavor'),
'page callback' => 'check_add',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
);

return $items;
}

function check_overview() {

$hey1 = "Say hi!";
return $hey1;

}

function check_add() {
return form_elements();

}

/**
* Implementation of hook_elements().
*
* Defines 'form' form element type.
*/
function form_elements() {
$type['form'] = array(
'#input' => TRUE,
'#stars' => 5,
'#widget' => 'stars',
'#allow_clear' => FALSE,
'#auto_submit' => FALSE,
'#auto_submit_path' => '',
'#labels_enable' => TRUE,
'#process' => array('form_expand'),
);
return $type;
}

Thanks

Comments

jaypan’s picture

return form_elements();

That's because this function returns an array.

You have to call drupal_get_form() somewhere.

Contact me to contract me for D7 -> D10/11 migrations.

TomDS’s picture

Hi

Thank you for your response, with what you've said I was able to continue.

Thanks

Tom