Closed (fixed)
Project:
Mobile Tools
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Jul 2011 at 12:02 UTC
Updated:
29 May 2012 at 16:37 UTC
Jump to comment: Most recent file
Fatal error: Call to undefined function mobile_tools_switch_menu_link() in [...]/sites/all/modules/mobile_tools/mobile_tools.module on line 198
I got this error when enabling the mobile switch block.
this function actually doesn't exist.
ps: If someone knows how to construct the path for the links I could create a custom block waiting the fix.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | switch_menu_link-1226580-10.patch | 2.14 KB | slucero |
| #7 | switch_menu_link-1226580-7.patch | 1.98 KB | minoroffense |
| #6 | switch_menu_link-1226580-6.patch | 2.19 KB | minoroffense |
| #4 | switch_menu_link-1226580-5055012.patch | 1.92 KB | minoroffense |
| #2 | switch_menu_link-1226580-2.patch | 1.71 KB | roborn |
Comments
Comment #1
martinar commentedI'm getting the same error:
Fatal error: Call to undefined function mobile_tools_switch_menu_link() in [...]/sites/all/modules/mobile_tools/mobile_tools.module on line 192.
I need to fix this error asap to use the mobile version of my site.
Any help is appreciated.
Thank you in advance
Comment #2
roborn commentedI got the same error.
Here's a patch to fix this issue.
Comment #3
minoroffense commentedEDIT: Seems as though /mt/ is something special. However it doesn't do the redirect properly even with the patch above (at least for me). I'll have to do some more digging.
The patch provided hard codes the URL pattern into the links. It doesn't take the actual mobile URL configuration into account.
You would need to load the mobile_tools_mobile_url variable and mobile_tools_desktop_url variable to build the links.
I would suggest something like this.
Unless the /mt is a special URL that causes a redirect of some kind that I'm not aware of.
Comment #4
minoroffense commentedSee above
Comment #5
minoroffense commentedMy patch isn't the right solution. Switching back to need works.
Comment #6
minoroffense commentedHere's a new patch. I think the issue of not redirecting for me using the original patch is related to some logical errors later on the the code.
Your patch does add the right code to fix the issue. I'll open/check for another issue to fix the other problem.
I've uploaded a new patch with the changes in place plus some extra doc comments.
Comment #7
minoroffense commentedOops, wrong patch file...ugh it's been a long day...
Here's the correct one.
Comment #8
jtwalters commentedPatch from #7 seems to work, however, when I try to go *back* to the desktop version, I get this error:
Recoverable fatal error: Argument 1 passed to drupal_http_build_query() must be an array, string given, called in /Library/WebServer/Documents/dev/includes/common.inc on line 2161 and defined in drupal_http_build_query() (line 472 of /Library/WebServer/Documents/dev/includes/common.inc).
Comment #9
minoroffense commentedComment #10
sluceroThis patch is a rebuild of the patch from comment #7. It has a minor adjustment to account for the issues reported in comment #8.
Comment #11
minoroffense commentedI'll review the patch and apply it to a new unstable release later today.
Comment #12
alive2000 commentedI confirm that the patch #10 works as expected
Comment #13
scottAtRoot802 commentedI've applied this patch and I'm happy to say it works with one exception. Everything is working as it should on the iPhone, Andriod and Blackberry devices. However, there remains one small bug for me on the iPad. It's possible the bug I'm experiencing is not directly related this bug / patch, but then again the root of this issue is alluding me. If it is appropriate to open a separate issue, I'm happy to do so.
The issue I'm having is this. On an iPad, the site detects a mobile device and shows the correct mobile theme, however the iPad is not redirected to the mobile url as I've configured Mobile Tools to do. This is the first red flag. The site functions fine, until you click on the link to switch from the mobile to desktop version. Actually, since you are still at the desktop url, the link says "View mobile website" even though you are already viewing the mobile theme. Clicking on that link takes you to the mobile url / theme and the link then changes to "View desktop website". Clicking on that takes me to a "Sorry, you can not access this page" at the desktop url even though the destination seems correct "/mt/desktop/node/5". Node 5 is the home page. This is red flag #2. I should also mention that the theme never switches, it remains on the mobile theme no matter what I do. Changing the url path to something else doesn't help. Not that I expected it to help but I had to try.
Beyond this, I have no further clues what's causing the issue. There are no reported errors. It's not clear to me whether this is directly related this bug / patch, if my configuration is incorrect, if there is a redirection issue or something else.
To give you a clearer picture, I have the following configuration:
I'm using my own custom mobile theme which is integrated with jquery mobile. For those that a familuar with jquery mobile, the links for mobile theme switching have data-role=none and data-ajax=false. There should be no interference from jquery mobile and my tests prove this to be the case. Of course, at this point I haven't ruled out anything.
I made a slight modification to the mobile tools module by adding "Kindle" to list of detected mobile devices in _mobile_tools_device_groups() and _mobile_tools_is_mobile_device() functions. The addition or exclusion of this modification seems to have no effect on the issue I'm having with the iPad.
Again, everything work perfectly for every other device I've tested (iPhone, Galaxy S Andriod, Kindle Fire, and a Blackberry). This issue appears to be isolated to the iPad. If anyone can can give me some guidance with this one I would greatly appreciate it. Thanks.
Comment #14
Patricia_W commentedI tried to apply the patch #10 but my patch reports that all hunks fail:
Hunk #1 FAILED at 145.
Hunk #2 FAILED at 200.
Hunk #3 FAILED at 846.
I am attempting to apply the patch to:
version = "7.x-2.x-dev"
core = "7.x"
project = "mobile_tools"
datestamp = "1323822840"
I'm using the patch program on Mac OS X 10.7
Any suggestions?
Comment #15
Patricia_W commentedI got around this problem by applying the patch code manually since none of the line numbers matched. No idea why because I was using the correct version. I tried both versions and neither matched.
Comment #16
indigoxela commentedHi,
function mobile_tools_switch_menu_link() is also missing in mobile_tools version 7.x-2.0-unstable1 (datestamp = "1319659535").
This is leading to a fatal error, when trying to save new content:
PHP Fatal error: Call to undefined function mobile_tools_switch_menu_link() in /var/www/.../modules/mobile_tools/mobile_tools.module on line 199As a quick fix I inserted
function mobile_tools_switch_menu_link() {}in mobile_tools.module, but of course links in mobile switch block don't work.
Comment #17
brandy.brown commentedthe patch in #10 worked for me. However, I left off the last two lines on the patch because it forced a syntax error.
Comment #18
minoroffense commentedThis issue was fixed in a previous commit and has been moved to the 7.x-3.x branch.
The issue is also fixed in the 6.x-2.x branch.