Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with static map styles in PHP #70

Closed
daltonrooney opened this issue Nov 4, 2022 · 2 comments
Closed

Help with static map styles in PHP #70

daltonrooney opened this issue Nov 4, 2022 · 2 comments
Labels
Bug Report Something isn't working

Comments

@daltonrooney
Copy link

I'm trying to apply some map styles in a PHP implementation & seem to be missing something. I first tried converting the style object to PHP array syntax like so:

$mapStyles = [
  [
    "featureType" => "poi.business",
    "stylers" => [
      [
        "visibility" => "off"
      ]
    ]
  ]
];

Which results in a PHP Array to string conversion error in doublesecretagency/craft-googlemaps/src/models/StaticMap.php at line 235. So I tried using json_decode with the JSON that I got from Google like this:

$mapStyles = json_decode('[
  {
    "featureType": "poi.business",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  }
]');

But got the same error. Is there an example of a working style config in PHP I could reference? Thanks so much!

Google Maps plugin version 2.5.2
Craft CMS version 4.3.1

@lindseydiloreto lindseydiloreto added the Bug Report Something isn't working label Dec 29, 2022
@lindseydiloreto
Copy link
Collaborator

This is fixed, and will be available in the next release. The styles option for static maps should now behave as expected.

If you'd like to get the latest dev version now, change your composer.json file to say...

"doublesecretagency/craft-googlemaps": "dev-v4-dev"

... and then run composer update.

Thanks for filing this issue! 🍺

@lindseydiloreto
Copy link
Collaborator

This patch has been officially released in v4.3. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants