When saving preset behaviors, always getting

# warning: asort() expects parameter 1 to be array, null given in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 615.
# warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 616.
# warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 616.
# warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 629.
# warning: asort() expects parameter 1 to be array, null given in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 615.
# warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 616.
# warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 616.
# warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/openlayers/modules/openlayers_ui/includes/openlayers_ui.presets.inc on line 629.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

strk’s picture

Could you send a var_dump of $values when !isset($values['layer_weight']) in modules/openlayers_ui/includes/openlayers_ui.presets.inc ~ line 614 ?
I'm thinking a possible reason could be calls to openlayers_ui_presets_form_process with empty or no first arg.

dgastudio’s picture

same problem.

Agileware’s picture

Title: Warnings when saving preset behaviors » Warnings when saving presets
FileSize
85.94 KB
12.58 KB

Changing the title as it is just saving presets in general that causes this.

Re #1:
Attached is a var dump of $values when !isset($values['layer_weight'])

I also notice that on the "Layers & Styles" tab there is an overlay layers table below the base layers table that is empty aside from headers, one of which is for weight (screenshot attached).

Agileware’s picture

The problem goes away after I have created at least one OpenLayers Data view.

Then the overlay layers table is not empty (see screenshot) and you don't get the error.

strk’s picture

Assigned: Unassigned » strk
Status: Active » Needs review
FileSize
944 bytes

@ckng : please try the attached patch (will need you to re-delete your OpenLayersData view to check).

ckng’s picture

FileSize
8.82 KB

Do no see the different with the patch, getting same errors.
Attached is var_dump($values), the $values['layer_weight'] does not exist.

strk’s picture

What about this one ?

strk’s picture

I don't understand how you can have ["layer_styles"] and not have ["layer_weight"] when openlayers_ui_presets_form_process is invoked.

ckng’s picture

#7 does not work as well.
["layer_styles"] present with #5, with #7 both also not present.

On openlayers_ui_presets_form_submit(), the values are set in $form, however the submit function only processes $form_state?
BTW, I'm not using OpenLayers Data view, ATM.

strk’s picture

Status: Needs review » Active

I'm in the process of setting up an environment with no overlay layers to reproduce this.

strk’s picture

Status: Active » Fixed
ckng’s picture

Confirmed #11 works.

Status: Fixed » Closed (fixed)

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