Timeline for How do I get the current path alias or path?
Current License: CC BY-SA 4.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 27 at 14:30 | history | edited | sonfd | CC BY-SA 4.0 | add missing "=" |
| Oct 16, 2024 at 12:03 | history | edited | norman.lol | CC BY-SA 4.0 | $current_uri without query |
| Aug 27, 2021 at 4:37 | history | edited | monymirza | CC BY-SA 4.0 | service name changes in latest Core |
| Jun 16, 2021 at 9:46 | comment | added | Pauleau | I agree about the route name subject. For example, if you want to check if you're in the /user/xxx url, it would be better to use : drupal.stackexchange.com/questions/202831/… > if (\Drupal::routeMatch()->getRouteName() === 'entity.user.canonical') than checking the path. | |
| S Jan 16, 2020 at 10:41 | history | suggested | Pupil | CC BY-SA 4.0 | Added semi-colon to avoid Parse Error in case somebody uses code as it is. |
| Jan 16, 2020 at 6:22 | review | Suggested edits | |||
| S Jan 16, 2020 at 10:41 | |||||
| Sep 2, 2016 at 8:02 | vote | accept | Yuseferi | ||
| Apr 14, 2016 at 14:11 | comment | added | Philipp Michael | getAliasByPath does return the path without language prefix. Any idea how to solve this? | |
| S Sep 26, 2015 at 12:51 | history | suggested | hugronaphor | CC BY-SA 3.0 | Stripping the slash is not necessary as of Drupal8 beta15 |
| Sep 26, 2015 at 10:17 | review | Suggested edits | |||
| S Sep 26, 2015 at 12:51 | |||||
| Sep 15, 2015 at 20:12 | comment | added | othermachines | Just a note that ::getAliasByPath() will no longer accept a path string without a leading slash (since beta13 I believe). | |
| Jun 29, 2015 at 6:04 | comment | added | rjacobs | @darol100, I may not be the best person to provide a comprehensive answer for that, but I can tell you that the use of paths for programmatic URL generation is officially depreciated in Drupal 8 - see: drupal.org/node/2046643. Symfony routes provide a more robust way to map resources independent of the path structures (if you build a link using routes, that link will keep working even if the URL path/pattern changes). | |
| Jun 26, 2015 at 12:48 | comment | added | itsdarrylnorris | why you mention that it would be better to use routes instead of paths ? Can you provide a brief example/reason ? | |
| Mar 4, 2015 at 0:54 | history | edited | rjacobs | CC BY-SA 3.0 | Fix typo |
| Mar 2, 2015 at 1:31 | history | answered | rjacobs | CC BY-SA 3.0 |