diff --git a/development/components/form/types-reference/_index.md b/development/components/form/types-reference/_index.md index 92e0900c6b..ea299fa00f 100644 --- a/development/components/form/types-reference/_index.md +++ b/development/components/form/types-reference/_index.md @@ -29,6 +29,7 @@ Developers can already use a large list of field types (see [Symfony types](http | [`EntitySearchInputType`](entity-search-input-type) | PrestaShopBundle\Form\Admin\Type | This form type is used for a OneToMany (or ManyToMany) association, it allows to search a list of entities (based on a remote url) and associate it. It is based on the CollectionType form type which provides prototype features to display a custom template for each associated items. | | [`FormattedTextareaType`](formatted-textarea) | PrestaShopBundle\Form\Admin\Type | Class enabling TinyMCE on a Textarea field | | [`GeneratableTextType`](generatable-text) | PrestaShopBundle\Form\Admin\Type | It is extension of TextType that adds additonal button which allows generating value for input | +| [`GeoCoordinatesType`](geo-coordinates) | PrestaShopBundle\Form\Admin\Type | This form class is responsible to create a geolocation latitude/longitude coordinates field. | | [`IconButtonType`](icon-button-type) | PrestaShopBundle\Form\Admin\Type | A form button with material icon. | | [`ImagePreviewType`](image-preview-type) | PrestaShopBundle\Form\Admin\Type | This form type is used to display an image value without providing an interactive input to edit it. It is based on a hidden input so it could be changed programmatically, or be used just to display an image in a form. | | [`IntegerMinMaxFilterType`](integer-min-max-filter) | PrestaShopBundle\Form\Admin\Type | Defines the integer type two inputs of min and max value - designed to fit grid in grid filter. | diff --git a/development/components/form/types-reference/geo-coordinates.md b/development/components/form/types-reference/geo-coordinates.md new file mode 100644 index 0000000000..f4412cd3f6 --- /dev/null +++ b/development/components/form/types-reference/geo-coordinates.md @@ -0,0 +1,52 @@ +--- +title: GeoCoordinatesType +--- + +# GeoCoordinatesType + +This form class is responsible to create a geolocation latitude/longitude coordinates field. + +## Type options + +| Option | Type | Default value | Description | +|:-----------------------|:-----|:--------------|:-----------------------------------------------------------------------------------------------------------------------| +| label_longitude | string | Longitude | Longitude label | +| label_latitude | string | Latitude | Latitude label | + +## Required Javascript components + +None. + +## Code example + +Add `GeoCoordinatesType` to your form. + +```php +add('coordinates', GeoCoordinatesType::class) + ; + } +} +``` + +Find a complete implementation in the [demosymfonyform module](https://github.com/PrestaShop/example-modules/blob/master/demosymfonyform/src/Controller/DemoGeoCoordinatesFormController.php). + +## Updating the coordinates + +The `GeoCoordinatesType` renders two input fields that must be provided when updating the value: + +- **latitude** - the north-south position +- **longitude** - the east-west position + +## Preview example + +{{< figure src="../img/geo_coordinates.png" title="GeoCoordinatesType rendered in form example" >}} diff --git a/development/components/form/types-reference/img/geo_coordinates.png b/development/components/form/types-reference/img/geo_coordinates.png new file mode 100644 index 0000000000..c6bd01cfad Binary files /dev/null and b/development/components/form/types-reference/img/geo_coordinates.png differ