diff --git a/src/fields/Address.php b/src/fields/Address.php index 107c62f..5c5a46b 100644 --- a/src/fields/Address.php +++ b/src/fields/Address.php @@ -89,7 +89,7 @@ public function getTableAttributeHtml(mixed $value, ElementInterface $element): return "
$value"; } - + public function getInputHtml(mixed $value, ?ElementInterface $element = null): string { Craft::$app->getView()->registerAssetBundle(AddressFieldAsset::class); @@ -192,7 +192,8 @@ private function renderFieldJs() 'defer' => '', 'position' => View::POS_END, 'depends' => [AddressFieldAsset::class], - ] + ], + 'googleMapsPlaces' ); } @@ -202,7 +203,7 @@ private function renderAddressFields($value): string $id = Html::id($this->handle); $namespace = Craft::$app->getView()->getNamespace(); $namespacedId = Craft::$app->getView()->namespaceInputId($id); - + $countryCode = $value ? $value->getCountryCode() : $this->defaultCountryCode; if (empty($countryCode)) { @@ -351,7 +352,7 @@ protected function getFieldLabels(AddressFormat $addressFormat): array return $labels; } - + public function getCountryOptions(): array { $countryRepository = new CountryRepository(); @@ -366,7 +367,7 @@ public function getCountryOptions(): array return $options; } - + private function getSubdivisionOptions($countryCode, $parentId = null): array { if (!$countryCode) { @@ -391,7 +392,7 @@ private function getSubdivisionOptions($countryCode, $parentId = null): array return $options; } - + public function normalizeValue(mixed $value, ?ElementInterface $element = null): mixed { /** @@ -418,7 +419,7 @@ public function normalizeValue(mixed $value, ?ElementInterface $element = null): return null; } - + public function serializeValue(mixed $value, ?ElementInterface $element = null): mixed { if (empty($value)) {