3namespace Bitrix\Location\Source\Google\Converters;
5use Bitrix\Location\Entity\Address;
6use Bitrix\Location\Entity\Address\FieldType;
7use Bitrix\Location\Entity\Location;
8use Bitrix\Location\Exception\RuntimeException;
9use Bitrix\Location\Source\Google;
25 if(isset(
$data[
'status']) &&
$data[
'status'] !==
'OK')
31 if(!isset(
$data[
'result']))
38 if(isset(
$data[
'types']) && is_array(
$data[
'types']))
49 ->setExternalId((
string)
$data[
'place_id'])
50 ->setName((
string)
$data[
'name'])
51 ->setLongitude((
string)
$data[
'geometry'][
'location'][
'lng'])
52 ->setLatitude((
string)
$data[
'geometry'][
'location'][
'lat'])
54 ->setLanguageId($this->languageId);
56 if(is_array(
$data[
'address_components']))
58 if ($address = $this->
createAddress($data[
'address_components']))
60 $address->setLatitude(
$result->getLatitude());
61 $address->setLongitude(
$result->getLongitude());
64 if($address->isFieldExist(FieldType::POSTAL_CODE))
67 FieldType::POSTAL_CODE,
68 $address->getFieldValue(FieldType::POSTAL_CODE)
72 if(!$address->isFieldExist(FieldType::ADDRESS_LINE_2) &&
$type ===
Location\Type::UNKNOWN)
74 $address->setFieldValue(FieldType::ADDRESS_LINE_2, (
string)
$data[
'name']);
createAddress(array $addressComponents)
convertTypes(array $types, string $typesClass)
const CONVERTER_BYID_ERROR
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage