bug fix url direct access #2936

This commit is contained in:
Bachir Soussi Chiadmi 2024-10-15 11:46:42 +02:00
parent 3cdde357d5
commit 931c6ba216
1 changed files with 4 additions and 2 deletions

View File

@ -35,13 +35,15 @@ function decoupled_page_attachments(array &$attachments) {
$redirect = false; $redirect = false;
$current_path = \Drupal::service('path.current')->getPath(); $current_path = \Drupal::service('path.current')->getPath();
$route_name = \Drupal::routeMatch()->getRouteName(); $route_name = \Drupal::routeMatch()->getRouteName();
// $route_parameters = \Drupal::routeMatch()->getParameters()->all();
// ksm($route_parameters);
$current_language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
$is_front = \Drupal::service('path.matcher')->isFrontPage(); $is_front = \Drupal::service('path.matcher')->isFrontPage();
if (!$is_front) { if (!$is_front) {
$redirect = true; $redirect = true;
} }
if(preg_match('/^\/?user\/.*/', $current_path)){
$redirect = false;
}
$entity_type = null; $entity_type = null;
$entity_bundle = null; $entity_bundle = null;
$entity_id = null; $entity_id = null;