Contemplate creates menu errors
perarnet - March 2, 2008 - 21:13
| Project: | Content Templates (Contemplate) |
| Version: | 6.x-0.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | jrglasgow |
| Status: | closed |
Jump to:
Description
When enabling contemplate I get the following error on many pages (/admin for example):
warning: Invalid argument supplied for foreach() in [..]l\includes\menu.inc on line 258.
I'm running Drupal 6.1 and I verified the problem both hosted and on xampp.

#1
I get the same error on drupal 6.0
#2
that's what I get for not showing errors on the page and just logging them
#3
I see the same warning. (see #228591: Invalid argument supplied for foreach() in /.../includes/menu.inc which I marked as duplicate]
#4
This was caused by a mistake in the new menu system, or at least the way I implemented it with the upgrade.
When implementing the new menu system you need to make sure all the 'arguments' in the array are arrays themselves, I replaced
<?php$items['admin/content/templates'] = array(
'title' => t('Content templates'),
'description' => t('Create templates to customize output of teaser and body content.'),
'access callback' => 'user_access',
'access arguments' => 'administer templates',
'page callback' => 'contemplate_edit_type',
'page arguments' => array(3),
);
?>
with this
<?php$items['admin/content/templates'] = array(
'title' => 'Content templates',
'description' => 'Create templates to customize output of teaser and body content.',
'access callback' => 'user_access',
'access arguments' => array('administer templates'),
'page callback' => 'contemplate_edit_type',
'page arguments' => array(3),
'type' => MENU_CUSTOM_ITEM,
);
?>
You need to make sure you clear all cache tables in your database.
This at least fixed it on my system, if someone is still having this problem let me know.
#5
Fix will appear in the next release 6.x-0.4
#6
Thanks for the quick work!
#7
I try
#8
I try
#9
This helped me fix a problem I was having with one of my own modules. Can you provide a link to where you found the info about the arguments needing to be arrays?
#10
I did a search for
foreach() menu.incin the drupal.org search and I found this
#201290: Invalid argument supplied for foreach() in menu.inc
#11
Automatically closed -- issue fixed for two weeks with no activity.