diff --git a/config/optional/pathauto.pattern.user_site_mapping.yml b/config/optional/pathauto.pattern.user_site_mapping.yml new file mode 100644 index 0000000..70daf09 --- /dev/null +++ b/config/optional/pathauto.pattern.user_site_mapping.yml @@ -0,0 +1,14 @@ +langcode: pt-br +status: true +dependencies: + module: + - pathauto + - user +id: user_site_mapping +label: 'User site mapping' +type: 'canonical_entities:user' +pattern: 'user/[user:name]' +selection_criteria: { } +selection_logic: and +weight: 0 +relationships: { } diff --git a/modules/site_users_microsite/src/Theme/MicrositeThemeNegotiator.php b/modules/site_users_microsite/src/Theme/MicrositeThemeNegotiator.php index fa7e25a..2a46d71 100644 --- a/modules/site_users_microsite/src/Theme/MicrositeThemeNegotiator.php +++ b/modules/site_users_microsite/src/Theme/MicrositeThemeNegotiator.php @@ -15,15 +15,16 @@ class MicrositeThemeNegotiator implements ThemeNegotiatorInterface { */ public function applies(RouteMatchInterface $route_match): bool { $route_name = $route_match->getRouteName(); - $excluded = ['site_users_microsite.settings']; - if (in_array($route_name, $excluded)) { + if ($route_name === 'site_users_microsite.settings') { return FALSE; } - $current_path = \Drupal::service('path.current')->getPath(); - $alias = \Drupal::service('path_alias.manager')->getAliasByPath($current_path); - return (bool) preg_match('#^/user/\d+(/|$)#', $alias); + if ($route_name === 'entity.user.canonical') { + return TRUE; + } + + return str_starts_with($route_name, 'site_users_microsite.'); } /**