HI, i have a custom modal and it works fine.
BUt I get this error in watchdog:
Invalid argument supplied for foreach() in /is/.../drupal/includes/menu.inc on line 260.
This is the menu code for the modal:
function vf_modal_forms_menu() {
$items = array();
foreach (node_get_types('types', NULL, TRUE) as $type) {
$type_url_str = str_replace('_', '-', $type->type);
$items['vf_modal_forms/%ctools_js/node/add/'. $type_url_str. '/%'] = array(
'title' => 'Create content',
'page callback' => 'vf_modal_forms_node_add_form',
'page arguments' => array(1, 4, 5),
'access callback' => 'node_access',
'access arguments' => array('create', $type->type),
'file' => 'vf_modal_forms.pages.inc',
'type' => MENU_CALLBACK,
);
.....
// menu.inc
/**
* The menu system uses serialized arrays stored in the database for
* arguments. However, often these need to change according to the
* current path. This function unserializes such an array and does the
* necessary change.
*
* Integer values are mapped according to the $map parameter. For
* example, if unserialize($data) is array('view', 1) and $map is
* array('node', '12345') then 'view' will not be changed because
* it is not an integer, but 1 will as it is an integer. As $map[1]
* is '12345', 1 will be replaced with '12345'. So the result will
* be array('node_load', '12345').
*
* @param @data
* A serialized array.
* @param @map
* An array of potential replacements.
* @return
* The $data array unserialized and mapped.
*/
function menu_unserialize($data, $map) {
if ($data = unserialize($data)) {
foreach ($data as $k => $v) {
if (is_int($v)) {
$data[$k] = isset($map[$v]) ? $map[$v] : '';
}
}
return $data;
}
else {
return array();
}
}
What could be the reason for this error?
Comments
Comment #1
merlinofchaos commentedInstead of the 4, you should probably just put $type->type in the 'page arguments' since that's basically static anyway. I *think* that may be what it's choking on, but I'm not completely sure.
This isn't really a CTools problem, it's an issue with your implementation of hook_menu and isn't really related (I don't think) to what the page callback is actually doing.
Comment #2
Apfel007 commentedthis are two more links.. the delete links seems to be ok and gives no error..
Comment #3
Apfel007 commentedthanks I will try it tomorrow..
Comment #4
joelpittetTriaging the 6.x issues, it's no longer supported.