function akcniletenky_xmlfiltr_preprocess_akcniletenky_xmlfiltr_page(&$variables) { $request = \Drupal::request(); $route_name = \Drupal::routeMatch()->getRouteName(); if ($route_name === 'akcniletenky_xmlfiltr.promo_tickets_page') { $query_params = $request->query->all(); $allowed_keys = ['destination' => 1, 'order' => 1, 'page' => 1]; $other_filters = array_diff_key($query_params, $allowed_keys); if (empty($other_filters) && !empty($query_params['destination'])) { $destination_metropolitan_iata = is_array($query_params['destination']) ? strtoupper(reset($query_params['destination'])) : strtoupper($query_params['destination']); $connection = \Drupal::database(); $destination_name = $connection->select('promo_ticket', 'pt') ->fields('pt', ['field_destination_city_name']) ->condition('field_destination_metropolitan_iata', $destination_metropolitan_iata) ->range(0, 1) ->execute() ->fetchField(); if ($destination_name) { $term_to_use = NULL; $term_storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); $terms = $term_storage->loadByProperties(['name' => $destination_name, 'vid' => 'destinace']); if ($term = reset($terms)) { $term_to_use = $term; } else { $tid_from_synonym = $connection->select('dealometr_synonyms', 'ds') ->fields('ds', ['tid']) ->condition('synonym', $destination_name) ->range(0, 1) ->execute() ->fetchField(); if ($tid_from_synonym) { $term_to_use = $term_storage->load($tid_from_synonym); } } if ($term_to_use) { $tid = (int)$term_to_use->id(); $display_name = $term_to_use->getName(); // Získání statistik pro widget $stats = $connection->select('dealometr_stats', 's') ->fields('s') ->condition('tid', $tid) ->execute() ->fetchAssoc(); if ($stats) { $variables['dealometr_widget'] = [ '#theme' => 'dealometr_widget_block', '#destination_name' => $display_name, '#stats' => $stats, '#attached' => ['library' => ['dealometr/chart']], '#hide_title_and_link' => TRUE, // <-- TENTO ŘÁDEK JE NOVÝ ]; } // Generování URL pro odkaz $transliteration = \Drupal::service('transliteration'); $slug = $transliteration->transliterate($display_name, 'cs'); $slug = strtolower(preg_replace('/[^a-zA-Z0-9]+/', '-', $slug)); $slug = trim($slug, '-'); if ($slug) { $url = \Drupal\Core\Url::fromRoute('dealometr.destination_by_slug', ['slug' => $slug]); $variables['dealometr_url'] = $url->toString(); $variables['destination_name'] = $display_name; } } } } } } Levné letenky El Al Israel Airlines na rok 2025 a 2026 | LevnéLetenky.org
Přejít k hlavnímu obsahu