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

GoogleMaps_TemplatesService.php data function looks to be broken #68

Open
vjonesmuth opened this issue Sep 23, 2016 · 0 comments
Open

Comments

@vjonesmuth
Copy link

When calling the data function on line 96 of GoogleMaps_TemplatesService.php the inputted $data is decoded and then not used. On the next line (102) $data is being reset to a new GoogleMaps_MapDataModel that is empty because the decoded $data variable is not getting passed in, $value is getting passed in an is type hinted as a array, so I suspect it's being set to an empty array by default so it's not throwing an error.

GoogleMaps_TemplatesService.php -> data()

public function data($id, $data = '', $options = array())
    {
        if(is_string($data))
        {
            $data = json_decode($data);

            $data = new GoogleMaps_MapDataModel((array) $value);
        }

        craft()->templates->includeJs('new GoogleMaps.MapData('.$id.','.$data->toJson().','.$this->jsonEncode($options).');');
    }

Should be :

public function data($id, $data = '', $options = array())
    {
        if(is_string($data))
        {
            $data = json_decode($data);

            $data = new GoogleMaps_MapDataModel((array) $data);
        }

        craft()->templates->includeJs('new GoogleMaps.MapData('.$id.','.$data->toJson().','.$this->jsonEncode($options).');');
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant