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;
}

Comments

devin carlson’s picture

Version: 6.x-2.4 » 6.x-2.x-dev
Assigned: Unassigned » devin carlson
Status: Active » Needs review
StatusFileSize
new899 bytes

Good catch!

A patch to implement the change.

devin carlson’s picture

Status: Needs review » Fixed

Committed to 6.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Small change in indentation of code