Closed (fixed)
Project:
Mobile Tools
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 Oct 2012 at 06:49 UTC
Updated:
30 Oct 2012 at 05:31 UTC
Jump to comment: Most recent file
I got the following error every now and then:
Invalid argument supplied for foreach() in /path/to/website/sites/all/modules/mobile_tools/mobile_tools.module on line 852.
So I looked in the code and found out that the piece of code that produces this error is actually never used:
/**
* Implementation of hook_content_build_modes().
*/
function mobile_tools_content_build_modes() {
$groups = mobile_tools_device_groups();
$modes = array();
foreach ($groups as $group => $title) {
$modes[$group] = array(
'title' => $title,
'views style' => TRUE,
);
}
$build_modes = array();
$build_modes['mobile_tools_types'] = array(
'title' => 'Mobile Device',
'build modes' => array(
'mobile' => array(
'title' => 'Mobile',
'views style' => TRUE,
),
),
);
return $build_modes;
}
It can be rewritten to the following without consequences (besides the error going away ;-) ):
/**
* Implementation of hook_content_build_modes().
*/
function mobile_tools_content_build_modes() {
$build_modes = array();
$build_modes['mobile_tools_types'] = array(
'title' => 'Mobile Device',
'build modes' => array(
'mobile' => array(
'title' => 'Mobile',
'views style' => TRUE,
),
),
);
return $build_modes;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | removed-unused-context-plugin-code-1807182-1.patch | 899 bytes | devin carlson |
Comments
Comment #1
devin carlson commentedGood catch!
A patch to implement the change.
Comment #2
devin carlson commentedCommitted to 6.x-2.x.
Comment #3.0
(not verified) commentedSmall change in indentation of code