Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gitoido/custom-map-form-type-bundle
https://github.com/gitoido/custom-map-form-type-bundle
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/gitoido/custom-map-form-type-bundle
- Owner: gitoido
- License: mit
- Created: 2017-02-01T08:11:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-13T08:13:40.000Z (almost 8 years ago)
- Last Synced: 2024-11-24T16:16:59.158Z (2 months ago)
- Language: PHP
- Size: 40 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CustomMapFormTypeBundle
Set the latitude and longitude using Custom Map
## Installation
Add warezgibzzz/custom-map-form-type-bundle to your `composer.json` file and run `composer`
```json
...
"require": {
"warezgibzzz/custom-map-form-type-bundle": "dev-master"
}
...
```Register the bundle in your `AppKernel.php`
```php
...
new Warezgibzzz\CustomMapFormTypeBundle\WarezgibzzzCustomMapFormTypeBundle(),
...
```Include bundle's scripts in your page:
```html
......
```## Usage
Just set the `custom_map` FormType for your field as follows:
```php
...
->add('coordinates', 'custom_map')
...
```The type takes and returns an array with items `lat` for the latitude and `lng` for the longitude. So you need to
configure your database coordinates column as `OBJECT` or create the setter and getter for it on your model.## Options
There are a few options that you can pass:
```php
...
->add('coordinates', 'custom_map', array(
'width' => 640, // The map's width
'height' => 480, // The map's height
'default' => array(
'x' => 5, // The default latitude value
'y' => 6 // The default longitude value
),
'parameters' => array(
'image' => 'http://placehold.it/640x480', // The map image
)
))
...
```## Configuration
You can configure default values for type's options to avoid passing them every time:
```yml
...
warezgibzzz_custom_map_form_type:
size:
width: 640
height: 480
default:
x: 5
y: 6
parameters:
image: 'custom#map'
...
```