From f93fa749d3834c361df5366d3aafc9c907d41d8e Mon Sep 17 00:00:00 2001 From: grek Date: Wed, 10 Feb 2016 13:10:01 +0100 Subject: [PATCH 01/18] zoom_callback --- Form/Type/GoogleMapType.php | 2 ++ Resources/public/js/jquery.ohgooglemaps.js | 6 ++++++ Resources/views/Form/google_maps.html.twig | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index 25cbe22..d75698d 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -37,6 +37,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) 'lat_name' => 'lat', // the name of the lat field 'lng_name' => 'lng', // the name of the lng field 'error_bubbling' => false, + 'zoom_callback' => false, //form callback 'map_width' => 300, // the width of the map 'map_height' => 300, // the height of the map 'default_lat' => 51.5, // the starting position on the map @@ -59,6 +60,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['default_lng'] = $options['default_lng']; $view->vars['include_jquery'] = $options['include_jquery']; $view->vars['include_gmaps_js'] = $options['include_gmaps_js']; + $view->vars['zoom_callback'] = $options['zoom_callback']; } public function getParent() diff --git a/Resources/public/js/jquery.ohgooglemaps.js b/Resources/public/js/jquery.ohgooglemaps.js index cbe40b6..224faeb 100755 --- a/Resources/public/js/jquery.ohgooglemaps.js +++ b/Resources/public/js/jquery.ohgooglemaps.js @@ -13,6 +13,7 @@ 'lat_field' : null, 'lng_field' : null, 'callback' : function (location, gmap) {}, + 'zoom_callback' : function (zoom) {}, 'error_callback' : function(status) { $this.settings.search_error_el.text(status); }, @@ -51,6 +52,10 @@ }); + google.maps.event.addListener(this.map, 'zoom_changed', function() { + $this.settings.zoom_callback($this.map.getZoom()); + }); + google.maps.event.addListener(this.map, 'click', function(event) { $this.insertMarker(event.latLng); }); @@ -158,6 +163,7 @@ 'lat_field' : null, 'lng_field' : null, 'callback' : function (location, gmap) {}, + 'zoom_callback' : function (zoom) {}, 'error_callback' : function(status) { $this.settings.search_error_el.text(status); } diff --git a/Resources/views/Form/google_maps.html.twig b/Resources/views/Form/google_maps.html.twig index b4df551..ee932f6 100755 --- a/Resources/views/Form/google_maps.html.twig +++ b/Resources/views/Form/google_maps.html.twig @@ -46,7 +46,8 @@ 'default_zoom' : {% if value is defined and value and value.lat and value.lng %}15{% else %}5{% endif %}, 'lat_field' : $('#{{ attribute(form, lat_name).vars.id }}'), 'lng_field' : $('#{{ attribute(form, lng_name).vars.id }}'), - 'callback' : oh_google_maps_callback + 'callback' : oh_google_maps_callback, + 'zoom_callback' : {{ zoom_callback|default('function(){}') }} }); }); From 3d51573f75d22298d3aef4e1d192b4fcc5018435 Mon Sep 17 00:00:00 2001 From: grek Date: Wed, 10 Feb 2016 13:39:59 +0100 Subject: [PATCH 02/18] update documentation --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 28c09ac..e5df36e 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,9 @@ Usage This bundle contains a new FormType called GoogleMapType which can be used in your forms like so: - $builder->add('latlng', 'oh_google_maps'); + $builder->add('latlng', 'oh_google_maps',array( + 'zoom_callback'=>'function(zoom){ $("#zoom").val(zoom); }' //optional zoom change listener + )); On your model you will have to process the latitude and longitude array From 9fef647d1aaf0f2fe99f616cea4b07bed020e722 Mon Sep 17 00:00:00 2001 From: grek Date: Wed, 10 Feb 2016 14:08:35 +0100 Subject: [PATCH 03/18] fix- add raw render function --- Resources/views/Form/google_maps.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Form/google_maps.html.twig b/Resources/views/Form/google_maps.html.twig index ee932f6..19131bf 100755 --- a/Resources/views/Form/google_maps.html.twig +++ b/Resources/views/Form/google_maps.html.twig @@ -47,7 +47,7 @@ 'lat_field' : $('#{{ attribute(form, lat_name).vars.id }}'), 'lng_field' : $('#{{ attribute(form, lng_name).vars.id }}'), 'callback' : oh_google_maps_callback, - 'zoom_callback' : {{ zoom_callback|default('function(){}') }} + 'zoom_callback' : {{ zoom_callback|default('function(){}')|raw }} }); }); From b4276a58f6ab0f0713c38518e1f842bc7566cff2 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 13:24:20 +0100 Subject: [PATCH 04/18] Update composer.json --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index ad1adad..9fd2edb 100755 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { - "name": "oh/google-map-form-type-bundle", + "name": "grekpg/google-map-form-type-bundle", "type": "symfony-bundle", "description": "Set latitude and longitude values on a form using Google Maps", "keywords": ["google maps", "symfony", "form"], - "homepage": "https://github.com/ollieLtd/OhGoogleMapFormTypeBundle", + "homepage": "https://github.com/grekpg/OhGoogleMapFormTypeBundle", "license": "MIT", "authors": [ { @@ -20,5 +20,5 @@ "Oh\\GoogleMapFormTypeBundle": "" } }, - "target-dir": "Oh/GoogleMapFormTypeBundle" + "target-dir": "Mea/GoogleMapFormTypeBundle" } From 6751020464640d40771cd286e0d297b4c6b01027 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 15:13:37 +0100 Subject: [PATCH 05/18] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9fd2edb..8a5b3f0 100755 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "grekpg/google-map-form-type-bundle", + "name": "grekpg/ohgooglemapformtypebundle", "type": "symfony-bundle", "description": "Set latitude and longitude values on a form using Google Maps", "keywords": ["google maps", "symfony", "form"], From 430b2deb2baf0ac07f2c16d12d12eb0be8650e7e Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 15:20:20 +0100 Subject: [PATCH 06/18] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8a5b3f0..3c5151a 100755 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3.2", - "symfony/framework-bundle": "~2.1" + "symfony/framework-bundle": ">=2.1,<3" }, "autoload": { "psr-0": { From ce004bfe570682bd0265d8400d8313ad2b4819d8 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 15:28:24 +0100 Subject: [PATCH 07/18] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3c5151a..20da1b0 100755 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "autoload": { "psr-0": { - "Oh\\GoogleMapFormTypeBundle": "" + "Mea\\GoogleMapFormTypeBundle": "" } }, "target-dir": "Mea/GoogleMapFormTypeBundle" From bab4ffaf8da5275e5b4b40f98471db1c5432f530 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 15:33:16 +0100 Subject: [PATCH 08/18] Update composer.json --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 20da1b0..422c084 100755 --- a/composer.json +++ b/composer.json @@ -7,8 +7,8 @@ "license": "MIT", "authors": [ { - "name": "Ollie Harridge", - "email": "code@oll.ie" + "name": "grek", + "email": "grek@g.pl" } ], "require": { @@ -17,8 +17,8 @@ }, "autoload": { "psr-0": { - "Mea\\GoogleMapFormTypeBundle": "" + "Oh\\GoogleMapFormTypeBundle": "" } }, - "target-dir": "Mea/GoogleMapFormTypeBundle" + "target-dir": "Oh/GoogleMapFormTypeBundle" } From 4e65a824a54b2b939db1be618d9cf286744ccbf2 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 13 Feb 2016 15:36:49 +0100 Subject: [PATCH 09/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e5df36e..a826cab 100755 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Installation This bundle is compatible with Symfony 2.1. Add the following to your `composer.json`: - "oh/google-map-form-type-bundle": "dev-master" + "grekpg/OhGoogleMapFormTypeBundle": "dev-master" Register the bundle in your `app/AppKernel.php`: From 64c53b5a0eb81b9f4d66d1d2149a68f7726c74e7 Mon Sep 17 00:00:00 2001 From: grekpg Date: Sat, 9 Feb 2019 22:36:31 +0100 Subject: [PATCH 10/18] Update composer.json remove symfony/framework-bundle version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 422c084..46e61bf 100755 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": ">=5.3.2", - "symfony/framework-bundle": ">=2.1,<3" + "symfony/framework-bundle": "*" }, "autoload": { "psr-0": { From 7669e67ad38089d6733ba8994bc2492b8651c3bf Mon Sep 17 00:00:00 2001 From: Grzegorz Krzywda Date: Tue, 26 Feb 2019 14:07:49 +0100 Subject: [PATCH 11/18] fix - compound not shown inputs --- Form/Type/GoogleMapType.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index d75698d..5f018c7 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -3,11 +3,13 @@ namespace Oh\GoogleMapFormTypeBundle\Form\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormInterface; use Symfony\Component\OptionsResolver\Options; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class GoogleMapType extends AbstractType @@ -18,6 +20,9 @@ class GoogleMapType extends AbstractType */ public function buildForm(FormBuilderInterface $builder, array $options) { + + unset($options['options']['compound']); + $builder ->add($options['lat_name'], $options['type'], array_merge($options['options'], $options['lat_options'])) ->add($options['lng_name'], $options['type'], array_merge($options['options'], $options['lng_options'])) @@ -27,11 +32,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'type' => 'text', // the types to render the lat and lng fields as - 'options' => array(), // the options for both the fields + 'type' => TextType::class, // the types to render the lat and lng fields as + 'compound'=>true, + 'options' => array( + 'compound'=>true + ), // the options for both the fields 'lat_options' => array(), // the options for just the lat field 'lng_options' => array(), // the options for just the lng field 'lat_name' => 'lat', // the name of the lat field @@ -65,10 +73,10 @@ public function buildView(FormView $view, FormInterface $form, array $options) public function getParent() { - return 'form'; + return TextType::class; } - public function getName() + public function getBlockPrefix() { return 'oh_google_maps'; } From 3f58ea9debe422d1f3c2de4152a9f9fc059b2b70 Mon Sep 17 00:00:00 2001 From: Grzegorz Krzywda Date: Tue, 26 Feb 2019 14:08:09 +0100 Subject: [PATCH 12/18] prepare for configurable api keys --- DependencyInjection/Configuration.php | 7 +++++++ README.md | 2 +- Resources/config/services.xml | 1 + Resources/public/js/jquery.ohgooglemaps.js | 3 ++- Resources/views/Form/google_maps.html.twig | 17 ++++++++++------- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 9a273b6..41df27c 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -22,6 +22,13 @@ public function getConfigTreeBuilder() $rootNode = $treeBuilder->root('oh_google_map_form_type'); + + $rootNode + ->children() + ->scalarNode('api_key')->defaultNull()->end() + ->scalarNode('include_gmaps_js')->defaultFalse()->end() + ->end(); + // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. diff --git a/README.md b/README.md index a826cab..e905d4c 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Usage This bundle contains a new FormType called GoogleMapType which can be used in your forms like so: - $builder->add('latlng', 'oh_google_maps',array( + $builder->add('latlng', GoogleMapType::class,array( 'zoom_callback'=>'function(zoom){ $("#zoom").val(zoom); }' //optional zoom change listener )); diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 6cac9f7..f9343a7 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -12,6 +12,7 @@ + "%form.type.oh_google_maps.class%" \ No newline at end of file diff --git a/Resources/public/js/jquery.ohgooglemaps.js b/Resources/public/js/jquery.ohgooglemaps.js index 224faeb..b0a49cb 100755 --- a/Resources/public/js/jquery.ohgooglemaps.js +++ b/Resources/public/js/jquery.ohgooglemaps.js @@ -165,7 +165,8 @@ 'callback' : function (location, gmap) {}, 'zoom_callback' : function (zoom) {}, 'error_callback' : function(status) { - $this.settings.search_error_el.text(status); + //todo: what is this ? console.log(status); + //$this.settings.search_error_el.text(status); } } diff --git a/Resources/views/Form/google_maps.html.twig b/Resources/views/Form/google_maps.html.twig index 19131bf..7a6df2e 100755 --- a/Resources/views/Form/google_maps.html.twig +++ b/Resources/views/Form/google_maps.html.twig @@ -2,7 +2,9 @@
{% block oh_google_maps_html %}
-
Current location + +
+ Current location
@@ -17,13 +19,14 @@ {% endif %} {% if include_gmaps_js %} - + + {% endif %} - {% javascripts - '@OhGoogleMapFormTypeBundle/Resources/public/js/jquery.ohgooglemaps.js' - %} - - {% endjavascripts %} + {#{% javascripts#} + {#'@OhGoogleMapFormTypeBundle/Resources/public/js/jquery.ohgooglemaps.js'#} + {#%}#} + {##} + {#{% endjavascripts %}#} {% endblock %} {% block oh_google_maps_javascript %} {% block oh_google_maps_callback %} From 3f357f2dc5ed4a2fbfaf3166854e43f218fae1ce Mon Sep 17 00:00:00 2001 From: grekpg Date: Sun, 28 Jul 2019 19:28:12 +0200 Subject: [PATCH 13/18] Update GoogleMapType.php Add editable option --- Form/Type/GoogleMapType.php | 54 ++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index 5f018c7..f21e255 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -2,7 +2,10 @@ namespace Oh\GoogleMapFormTypeBundle\Form\Type; +use Mea\CoreBundle\Form\Type\StringType; +use Mea\CoreBundle\Service\ErrorService; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -20,13 +23,31 @@ class GoogleMapType extends AbstractType */ public function buildForm(FormBuilderInterface $builder, array $options) { + unset($options['options']['compound']); - unset($options['options']['compound']); + if($options['editable']) + $builder + ->add($options['lat_name'], $options['type'], array_merge($options['options'], $options['lat_options'])) + ->add($options['lng_name'], $options['type'], array_merge($options['options'], $options['lng_options'])) + ; - $builder - ->add($options['lat_name'], $options['type'], array_merge($options['options'], $options['lat_options'])) - ->add($options['lng_name'], $options['type'], array_merge($options['options'], $options['lng_options'])) - ; + else{ + + $entity = $builder->getData(); + + ErrorService::getInstance()->addDebug($builder); + + $builder + ->add($options['lat_name'],HiddenType::class, array_merge($options['options'], $options['lat_options'])) + ->add($options['lng_name'], HiddenType::class, array_merge($options['options'], $options['lng_options'])) +// ->add('Coordinates',StringType::class,[ +// 'data'=>'sdfdfs', +// 'required'=>false, +// 'mapped'=>false, +// ]) + ; + + } } /** @@ -35,6 +56,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( + 'editable' => true, 'type' => TextType::class, // the types to render the lat and lng fields as 'compound'=>true, 'options' => array( @@ -60,15 +82,16 @@ public function configureOptions(OptionsResolver $resolver) */ public function buildView(FormView $view, FormInterface $form, array $options) { - $view->vars['lat_name'] = $options['lat_name']; - $view->vars['lng_name'] = $options['lng_name']; - $view->vars['map_width'] = $options['map_width']; - $view->vars['map_height'] = $options['map_height']; - $view->vars['default_lat'] = $options['default_lat']; - $view->vars['default_lng'] = $options['default_lng']; - $view->vars['include_jquery'] = $options['include_jquery']; - $view->vars['include_gmaps_js'] = $options['include_gmaps_js']; - $view->vars['zoom_callback'] = $options['zoom_callback']; + $view->vars['editable'] = $options['editable']; + $view->vars['lat_name'] = $options['lat_name']; + $view->vars['lng_name'] = $options['lng_name']; + $view->vars['map_width'] = $options['map_width']; + $view->vars['map_height'] = $options['map_height']; + $view->vars['default_lat'] = $options['default_lat']; + $view->vars['default_lng'] = $options['default_lng']; + $view->vars['include_jquery'] = $options['include_jquery']; + $view->vars['include_gmaps_js'] = $options['include_gmaps_js']; + $view->vars['zoom_callback'] = $options['zoom_callback']; } public function getParent() @@ -78,6 +101,7 @@ public function getParent() public function getBlockPrefix() { - return 'oh_google_maps'; + return 'oh_google_maps'; + } } From 4986ff6815b51aae782431211604a79a135698d6 Mon Sep 17 00:00:00 2001 From: Grzegorz Krzywda Date: Thu, 8 Oct 2020 11:39:44 +0200 Subject: [PATCH 14/18] lat lng hidden --- Form/Type/GoogleMapType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index f21e255..d4af0c6 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -27,8 +27,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) if($options['editable']) $builder - ->add($options['lat_name'], $options['type'], array_merge($options['options'], $options['lat_options'])) - ->add($options['lng_name'], $options['type'], array_merge($options['options'], $options['lng_options'])) + ->add($options['lat_name'], HiddenType::class, array_merge($options['options'], $options['lat_options'])) + ->add($options['lng_name'],HiddenType::class, array_merge($options['options'], $options['lng_options'])) ; else{ From ca0f4e7a72688f79f2f5ff340a27fedc0c083a34 Mon Sep 17 00:00:00 2001 From: grekpg Date: Tue, 13 Apr 2021 21:28:08 +0200 Subject: [PATCH 15/18] Update GoogleMapType.php add zooom --- Form/Type/GoogleMapType.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index d4af0c6..ead6b9a 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -72,6 +72,7 @@ public function configureOptions(OptionsResolver $resolver) 'map_height' => 300, // the height of the map 'default_lat' => 51.5, // the starting position on the map 'default_lng' => -0.1245, // the starting position on the map + 'default_zoom' => 10, // the starting position on the map 'include_jquery' => false, // jquery needs to be included above the field (ie not at the bottom of the page) 'include_gmaps_js'=>true // is this the best place to include the google maps javascript? )); @@ -89,6 +90,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['map_height'] = $options['map_height']; $view->vars['default_lat'] = $options['default_lat']; $view->vars['default_lng'] = $options['default_lng']; + $view->vars['default_zoom'] = $options['default_zoom']; $view->vars['include_jquery'] = $options['include_jquery']; $view->vars['include_gmaps_js'] = $options['include_gmaps_js']; $view->vars['zoom_callback'] = $options['zoom_callback']; From 7c288a4cce904932d36fe1a92480d5c19fb73b62 Mon Sep 17 00:00:00 2001 From: Grzegorz Krzywda Date: Tue, 31 Aug 2021 16:23:59 +0200 Subject: [PATCH 16/18] allow push appoinment details in url --- Form/Type/GoogleMapType.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index ead6b9a..5cc3de1 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -1,5 +1,7 @@ vars['include_jquery'] = $options['include_jquery']; $view->vars['include_gmaps_js'] = $options['include_gmaps_js']; $view->vars['zoom_callback'] = $options['zoom_callback']; + + + + } public function getParent() From 3d6471f6b8de7a370a5c85f2ba4088d7d62aca82 Mon Sep 17 00:00:00 2001 From: grekpg Date: Wed, 16 Feb 2022 11:06:53 +0100 Subject: [PATCH 17/18] Update GoogleMapType.php default lat lon zoom from appConfig --- Form/Type/GoogleMapType.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Form/Type/GoogleMapType.php b/Form/Type/GoogleMapType.php index 5cc3de1..2fe4263 100755 --- a/Form/Type/GoogleMapType.php +++ b/Form/Type/GoogleMapType.php @@ -4,6 +4,7 @@ */ namespace Oh\GoogleMapFormTypeBundle\Form\Type; +use AppBundle\Model\AppConfig; use Mea\CoreBundle\Form\Type\StringType; use Mea\CoreBundle\Service\ErrorService; use Symfony\Component\Form\AbstractType; @@ -73,9 +74,9 @@ public function configureOptions(OptionsResolver $resolver) 'zoom_callback' => false, //form callback 'map_width' => 300, // the width of the map 'map_height' => 300, // the height of the map - 'default_lat' => 51.5, // the starting position on the map - 'default_lng' => -0.1245, // the starting position on the map - 'default_zoom' => 10, // the starting position on the map + 'default_lat' => AppConfig::LOCATION_DEFAULT_LAT, // the starting position on the map + 'default_lng' => AppConfig::LOCATION_DEFAULT_LNG, // the starting position on the map + 'default_zoom' => AppConfig::LOCATION_DEFAULT_ZOOM, // the starting position on the map 'include_jquery' => false, // jquery needs to be included above the field (ie not at the bottom of the page) 'include_gmaps_js'=>true // is this the best place to include the google maps javascript? )); From b7465f19b999241f4bf4ef486a52577c9ecc4f8c Mon Sep 17 00:00:00 2001 From: grekpg Date: Wed, 7 Dec 2022 16:32:33 +0100 Subject: [PATCH 18/18] Update Configuration.php update for symfony 5 --- DependencyInjection/Configuration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 41df27c..3a6486d 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -18,9 +18,9 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); + $treeBuilder = new TreeBuilder('oh_google_map_form_type'); - $rootNode = $treeBuilder->root('oh_google_map_form_type'); + $rootNode = $treeBuilder->getRootNode(); $rootNode