sergmoro1/yii2-yamap

Yandex map widget. One or more maps on a page. Lightweight & Simple in use.

Installs: 163

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-master 2016-02-15 06:29 UTC

This package is auto-updated.

Last update: 2024-05-12 03:01:37 UTC


README

Yii2 extension for Yandex map.

Installation

$ composer require sergmoro1/yii2-yamap "dev-master"

Usage

If you have one map in a view, define points on the map , set params, and place the widget.

<?= Yamap::widget([
	'points' => [
		[
			'lat' => 55.780669,
			'lng' => 49.144449,
			'icon' => '',
			'header' => 'Company name',
			'body'=> 'Sales & Marketing</br><small>Office</small>',
			'footer' => '8-800-200-07-71',
		],
	],
	'params' => ['visible' => true, 'zoom' => 13]
]); ?>

If you have more then one map, then place maps divs for each of them, and place the widget.

...

<div id='kazan_office' style='width:100%; height:300px; margin-right:10px; display:none;'></div>

...

<div id='moscow_office' style='width:100%; height:300px; margin-right:10px; display:none;'></div>

...

<?= Yamap::widget(['areas' =>
	[
		'kazan_office' => [
			'points' => [
				[
					'lat' => 55.780669,
					'lng' => 49.144449,
					'icon' => '',
					'header' => 'Company name',
					'body' => 'Sales & Marketing</br><small>Kazan office</small>',
					'footer' => '8-800-000-00-00',
				],
			],
			'params' => ['visible' => true, 'zoom' => 13]
		],
		'moscow_office' => [
			'points' => [
				[
					'lat' => 55.7643,
					'lng' => 37.6454,
					'icon' => '',
					'header' => 'Company name',
					'body' => 'Sales & Marketing</br><small>Moscow office</small>',
					'footer' => '+7 495 222-22-22',
				],
			],
			'params' => ['visible' => true,'zoom' => 15],
		],
]]); ?>