Всем привет, нужно передать данные координат юзера в Origin Coordinates
mnigma давал такой код
<?php hook_views_pre_view(Drupal\views\ViewExecutable $view, $display_id, array &$args){
if ($view->id() == 'rybolovnye_mesta') {
$filters = $view->display_handler->getOption('filters');
if (isset($_GET['geo']) && $_GET['geo'] == 1) {
$lat = $lon = false;
if (isset($_SESSION['fi']['ses_user.latitude'])) {
$lat = $_SESSION['fi']['ses_user.latitude'];
$lon = $_SESSION['fi']['ses_user.longitude'];
}
if ($lat && $lon) {
if (isset($filters['field_adres_na_karte_proximity']) && isset($filters['field_adres_na_karte_proximity']['location_input']['fixed_value:fixed_value']['settings'])) {
if (isset($filters['field_adres_na_karte_proximity']['location_input']['fixed_value:fixed_value']['settings']['location_settings']['settings']['latitude'])
&& isset($filters['field_adres_na_karte_proximity']['location_input']['fixed_value:fixed_value']['settings']['location_settings']['settings']['longitude'])
) {
$filters['field_adres_na_karte_proximity']['location_input']['fixed_value:fixed_value']['settings']['location_settings']['settings']['latitude'] = $lat;
$filters['field_adres_na_karte_proximity']['location_input']['fixed_value:fixed_value']['settings']['location_settings']['settings']['longitude'] = $lon;
$view->display_handler->overrideOption('filters', $filters);
}
}
} else {
if (isset($filters['field_adres_na_karte_proximity'])) {
unset($filters['field_adres_na_karte_proximity']);
$view->display_handler->overrideOption('filters', $filters);
}
}
} else {
if (isset($filters['field_adres_na_karte_proximity'])) {
unset($filters['field_adres_na_karte_proximity']);
$view->display_handler->overrideOption('filters', $filters);
}
}
}
}?>
можно переписать код под мою задачу на друпал 10 или написать свой код
Комментарии
Написал в приват, как сделать...