3 votes
Accepted

How to delete the existing alias in drupal 9 / 10

Delete path alias: Drupal(8/9/10) $path_alias_manager = \Drupal::entityTypeManager()->getStorage('path_alias'); // Load path alias by path $alias_objects = $path_alias_manager->loadByProperties([...
mini's user avatar
  • 692
1 vote

How do I parse a path alias?

// Retrieve an array that contains the path pieces. $path_args = arg(); // Check if the current page is the page you're looking for. if ($path_args[0] == 'about-us') { // Your code. }
Adrian Cid Almaguer's user avatar
1 vote
Accepted

How can I confirm a path is internal?

You should not check for internal. An url like internal:/robots.txt is internal, but it is no route and has no route parameters. So before you do Url::getRouteParameters() you should check for Url::...
Hudri's user avatar
  • 5,311
1 vote
Accepted

How to make it so theme function isn't used when editing a node with layout builder

More general for the block, if you want to make sure the theme function is only used when viewing the node and not in other node routes like editing, then check the route name first: function ...
4uk4's user avatar
  • 98.2k
1 vote
Accepted

path alias OK for default language, but no alias for others

The old node probably has an alias with the language code UND (-not specified-). You can add one in the alias table www.example.com/admin/config/search/path but not in the node edit form. See https://...
4uk4's user avatar
  • 98.2k
1 vote

Bulk update for unchecked "Generate automatic URL alias"

In my case (for Drupal10 ) bulk update was not generating aliases due to the fact that all the nodes (when you edit a node) had unchecked the checkbox "generate automatic alias". I have ...
GZveri's user avatar
  • 31

Only top scored, non community-wiki answers of a minimum length are eligible