I'm taking my first crack at writing a small module, and I'm getting an error when I try to access my admin settings form. First, here's the relevant code:

 * Implementation of hook_menu()
 function imagelist_menu($may_cache) {
 	$items = array();
 	if ($may_cache) {
		$items[] = array(
			'path' => 'admin/settings/imagelist',
			'title' => 'ImageList settings',
			'description' => t('Settings for the ImageList module.'),
			'callback' => 'drupal_get_form',
			'callback_arguments' => array('imagelist_admin_settings'),
			'access' => user_access('administer imagelist settings')
	return $items;

 * Define the settings form
function imagelist_admin_settings() {
	$form['imagelist_vocabulary'] = array(
		'#type' => 'select',
		'#title' => 'Select the vocabulary used to categorize photos',
		'#options' => taxonomy_get_vocabularies('image'),
		'#description' => t('Select the name of the vocabulary that will be used to categorize your photos'),
	$form['array_filter'] = array('#type' => 'hidden');
	return system_settings_form($form);

And here's the error I get when I try to access the form from the admin settings page:

    * warning: Missing argument 1 for drupal_get_form() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\flickrcck\includes\form.inc on line 48.
    * warning: Missing argument 1 for drupal_retrieve_form() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\flickrcck\includes\form.inc on line 178.
    * warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\flickrcck\includes\form.inc on line 217.

When I initially got the error, I realized I had the callback_argument key spelled incorrectly, and I changed that, but even after clearing the cache, signing out and back in, etc. I still get this error. I did some searching and found this issue, but it's for version 6.x and has to do with path aliases. Has anyone noticed this problem in 5.x (5.2 to be exact)? Is it something in my code, or a bug?



klapper’s picture

I had similar experiences when programming menus in 5.2. My problem was about not taking changed access permissions. It's about caching.

My quick workaround to clear the cache: go to admin/build/menu. This admin screen rebuilds the menu tree and clears the cache. So after visiting this admin page, your changes should have effect.

cu ed

wonder95’s picture

I tried what you suggested, but that didn't fix the problem. I still get the same error when I try to access the admin settings form.

klapper’s picture

menu item parameter is 'callback arguments' (without _).

wonder95’s picture

Good catch, klapper. That got me past the error. Thanks a lot.

janwari’s picture

thanks klapper

pcambra’s picture

I was not able to see it, thanks, this solved my "typroblem" ;D

feromca’s picture

Thanks klapper.. You answer solved my issue even after 4 years.... :-)

edson_dionisio’s picture

Don't work for me :(
my version is the most recent possible and don't work in this way. i am a new user for this CMS and a work with php programmer. how can i fix the problem?

here is the code:
function myform_menu(){
$items = array();

$items['admin/config/content/myform'] = array(
'title'=>'Nodes to text file',
'description'=>'Configuração para os nós do módulo',
'page callback'=>'drupal_get_form',
'page argument'=>array('myform_form'),
'callback arguments'=>array('acesso a páginas administrativas'),
return $items;

so guys, if you can help me, i'll be thanks a lot

Jaypan’s picture

page arguments

Edit: Also, there's no element 'callback arguments'. Having it won't hurt you, but it doesn't do anything either.

edson_dionisio’s picture

thank you guy,
this really make may test works, it's all because a 's' that was missing...
the other instruction i was removed before. :)