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

Custom Icon #15

Open
eshwarallaka opened this issue Jul 14, 2017 · 1 comment
Open

Custom Icon #15

eshwarallaka opened this issue Jul 14, 2017 · 1 comment

Comments

@eshwarallaka
Copy link

Hello,

Thank you for the plugin, Could you help me, how and where to add a custom marker icon.

I can able to add custom icon in js like icon: 'http://maps.google.com/mapfiles/ms/icons/blue.png'

@HenonoaH
Copy link

@eshwarallaka You may try similar to this by extending,

Map component

class GoogleMaps extends \yii2mod\google\maps\markers\GoogleMaps
{
    protected function registerAssets()
    {
        $view = $this->getView();
        GoogleMapsAsset::register($view);
        $view->registerJsFile($this->getGoogleMapsApiUrl(), ['position' => \yii\web\View::POS_HEAD]);
        $options = $this->getClientOptions();
        $view->registerJs("yii.googleMapManager.initModule({$options})", $view::POS_END, 'google-api-js');
    }
}

Asset file

class GoogleMapsAsset extends \yii2mod\google\maps\markers\GoogleMapsAsset
{
     public $sourcePath = '@vendor/../common/components/googlemap';

    /**
     * @var array
     */
    public $js = [
        'markerclusterer_compiled.js',
        'googlemap.js',
    ];
}

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

2 participants