PHP code example of andrewdanilov / yii2-city-switch

1. Go to this page and download the library: Download andrewdanilov/yii2-city-switch library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andrewdanilov / yii2-city-switch example snippets


return [
	...
	'bootstrap' => [
		...
		'cityswitch' => [
			'class' => andrewdanilov\cityswitch\backend\Bootstrap,
			// data params which you want to be associated with each city
			// in addition to city alias (`city`) and city name (`city_name`)
			'dataParams' => [
				'address' => 'City address',
				'phone' => 'City phone',
				'coords' => 'City address coordinates',
			],
			// defining access to module
			'access' => ['admin'],
		],
	],
];

<?= \andrewdanilov\cityswitch\CitySwitchMenu::widget() 

<?= \andrewdanilov\cityswitch\CitySwitchValue::widget(['param' => 'phone'])