Skip to content

Commit

Permalink
Fixed #38 for Craft 5
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed Aug 7, 2024
1 parent d5a8b91 commit 68a483f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Easy Address Field for Craft CMS

## 5.0.1 - 2024-08-07
### Fixed
- Fields now respect wether geocoding is enabled or not ([#38](https://github.com/studioespresso/craft-easyaddressfield/issues/38))

## 5.0.0 - 2024-02-10
### Added
- Finished Craft 5 release
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "studioespresso/craft-easyaddressfield",
"description": "The only address field you need",
"type": "craft-plugin",
"version": "5.0.0",
"version": "5.0.1",
"keywords": [
"cms",
"craftcms",
Expand Down
6 changes: 4 additions & 2 deletions src/services/FieldService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Craft;
use craft\base\Component;
use craft\base\ElementInterface;
use craft\helpers\ElementHelper;
use studioespresso\easyaddressfield\EasyAddressField;
use studioespresso\easyaddressfield\fields\EasyAddressFieldField;
use studioespresso\easyaddressfield\models\EasyAddressFieldModel;
Expand Down Expand Up @@ -38,8 +39,9 @@ public function saveField(EasyAddressFieldField $field, ElementInterface $elemen
$record->field = $field->id;
}

$value = EasyAddressField::$plugin->geoLocation()->locate($value);

if(!ElementHelper::isDraftOrRevision($element) && $field->geoCode) {
$value = EasyAddressField::$plugin->geoLocation()->locate($value);
}

$record->name = $value->name;
$record->street = $value->street;
Expand Down

0 comments on commit 68a483f

Please sign in to comment.