Closed (fixed)
Project:
Chaos Tool Suite (ctools)
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2012 at 05:19 UTC
Updated:
10 May 2012 at 22:40 UTC
The basic problem is when using a modal with a form all works great except when javascript is disabled.
When js is disable the page just shows a bunch of setting.
I figured out the root of the problem for this was due to the page arguments in hook_menu.
This is what I was using then I changed the page arguments to only point to %ctools... And thus the issue went away... Or so it seems.
$items['node/%node/%ctools_js/delete'] = array(
'title' => 'Delete Newslink',
'page callback' => 'newslink_modal_delete_confirm',
// Original page arguments.
// 'page arguments' => array(1, 2),
// New page arguments.
'page arguments' => array(2),
'access callback' => 'node_access',
'access arguments' => array('delete', 1),
'type' => MENU_CALLBACK,
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'),
);
Can anyone please tell me why this is just to help me further understand for future reference?
Thank you in advance.
Comments
Comment #1
merlinofchaos commentedI have no idea without being able to see the code behind it. Obviously this is a custom menu entry and presumably has custom code behind it.
Comment #2
merlinofchaos commentedMy best guess is that your callback isn't properly set up to react to the arguments.
Comment #3
walker2238 commentedI'm sorry...
And my callback...
Comment #4
merlinofchaos commentedWhat the above original page arguments are doing are sending the first argument (the loaded node) and the second argument (whether or not it's $js) to the function. However, your callback is declared like this:
It is set up to receive only 1 argument. What was probably happening is that $js is receiving the node, and thus $js always appears TRUE when used as a boolean.
What you really want is this:
That will allow you to not load the node based on arg(1) and properly receive the $js option.
Comment #5
walker2238 commentedAh, that makes everything so much clearer... Makes a lot of sense. Thank you for your time.
Comment #6.0
(not verified) commentedMissing php tags.