Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions development/components/form/types-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
52 changes: 52 additions & 0 deletions development/components/form/types-reference/geo-coordinates.md
Original file line number Diff line number Diff line change
@@ -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
<?php
// path/to/your/CustomType.php

use PrestaShopBundle\Form\Admin\Type\GeoCoordinatesType;

class CustomType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->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" >}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.