Problem/Motivation

After creating a new View which renders a Leaflet map, it is not possible to edit the map settings in the view. An ajax error is thrown in the browser console.

Steps to reproduce

  • Add a new (block) view in Views
  • Set the the Layout to 'Leaflet Map'
  • Save the view
  • Try to edit the map settings under Layout
  • The following error is thrown: Warning: Undefined array key \"weight\" in /var/www/html/web/modules/contrib/leaflet/src/LeafletSettingsElementsTrait.php on line 418

Proposed resolution

After investigation, there is no value weight set in the getDefaultSettings() function, if the weight value is missing. Attached patch fixes this problem.

CommentFileSizeAuthor
missing_weight.patch493 bytesmrcdrx

Issue fork leaflet-3491625

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mrcdrx created an issue. See original summary.

mrcdrx’s picture

Issue summary: View changes
mrcdrx’s picture

Issue summary: View changes

  • itamair committed e4499518 on 10.2.x
    Issue #3491625 by mrcdrx: Undefined array key 'weight' breaks Views...
itamair’s picture

Status: Active » Fixed

Thanks @mrcdrx ... nice catch.
This last commit https://git.drupalcode.org/project/leaflet/-/commit/e4499518816dd52dc98c... implements your patch but with a better positioning of the 'weight' default value in the array.
Closing this as fixed (and crediting you).

Status: Fixed » Closed (fixed)

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