Add option to ignore admin paths

Created on 25 November 2016, about 8 years ago
Updated 31 January 2023, about 2 years ago

Some (like) would find it strange that admin paths are also processed with aliases. For this use case I added validation and asetting to enable/disable this validation.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇳🇱Netherlands jefuri

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States neclimdul Houston, TX

    Here's an updated patch. It addresses my review but also makes this patch D10 compatible.

    Also this restores the test that was removed in #28

    Probably still needs real tests though.

  • 🇮🇳India rinku jacob 13 Kerala

    Hi @neclimdul ,Reviewed the patch on drupal version 9.5.3-dev. I think Sub-pathauto (Sub-path URL Aliases) Version: 8.x-1.x-dev Works with druapl versions 8 and 9. it is not compatible with D10. So i have tested the patch with drupal9. Patch works perfectly for me. Need RTBC+1

  • Status changed to Needs work almost 2 years ago
  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Needs re-roll

  • 🇺🇸United States fskreuz

    Reroll

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    Testing concern:
    - The default value of `process_admin_routes` is TRUE. However, in the `/tests/src/Kernel/SubPathautoKernelTest.php b/tests/src/Kernel/SubPathautoKernelTest.php` we have `\Drupal::configFactory()->getEditable('subpathauto.settings')->set('process_admin_routes', TRUE)->save();` Instead of replicating the default setting, in the test it should start with default settings and then toggle the setting and confirm it is working as expected.

  • Issue was unassigned.
  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)
  • Status changed to Needs review almost 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update almost 2 years ago
    Patch Failed to Apply
  • 🇺🇸United States neclimdul Houston, TX

    Improved testing. Does what Nick suggested plus a bit more because it doesn't look like there was any _actual_ testing of the new feature provided here.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update almost 2 years ago
    21 pass
  • 🇺🇸United States neclimdul Houston, TX

    woops... diff'd the wrong commit. This should be correct.

    Also noticed there was a dead property on the path processor. @see interdiff.

  • 🇬🇧United Kingdom mistergroove

    Nice one @neclimdul. Will test this today.

  • 🇧🇪Belgium lobsterr

    Maybe we should use a generic solution Ignore specific paths Needs work

    Like this we can ignore not only admin, but any path we want. It would be more flexible

  • Merge request !8Add option to ignore admin paths → (Open) created by fskreuz
  • Pipeline finished with Success
    4 months ago
    Total: 145s
    #316044
  • 🇨🇦Canada drupcanuck London, Ontario

    Re-rolled patch for 8.x-1.4

  • 🇨🇦Canada nickdickinsonwilde Victoria, BC (T'So-uke lands)

    MR shouldn't be introducing any code standards issues.
    see https://git.drupalcode.org/issue/subpathauto-2830425/-/pipelines/316044

  • 🇺🇸United States neclimdul Houston, TX

    Fixed

  • First commit to issue fork.
  • 🇺🇸United States DamienMcKenna NH, USA

    While testing the latest MR it gave an error that dynamic properties was deprecated, so adding the $adminCache property resolves the error.

    I would suggest creating a follow-on issue to rework some of the logic to properly use DI for \Drupal::cache(), and some of the other things that are loaded via services.

  • 🇺🇸United States DamienMcKenna NH, USA

    Marking the existing work as RTBC as it works really well.

  • 🇳🇱Netherlands batigolix Utrecht

    Can the maintainer give his opinion on this generic solution for ignoring paths?:

    Ignore specific paths Needs work

    I think that approach will clash with the one proposed in this issue above.

    Also the UI is not very clear:

    +      '#title' => $this->t('Apply sub-paths aliases to admin routes.'),
    

    For the user it is not clear what "admin routes" mean. Does this also apply to taxonomy and user edit paths, for example?

    I would avoid the word "route" because it is quite technical and because elsewhere in the UI it says "paths".

    My proposal would be: "Provide sub-path aliases for admin paths"

    +      '#description' => $this->t('This will enable routes like node/[id]/edit to also be altered.'),
    

    This is a bit hard to understand.

    My proposal would be "Creates aliases for admin paths like node/[id]/edit and user/[id]/edit"

    +      '#title' => $this->t('Apply sub-paths aliases to layout builder route.'),
    +      '#description' => $this->t('This will enable routes like node/[id]/layout to also be altered.'),
    

    Same issues.

    My proposal would be:
    "Provide sub-path aliases for layout builder paths"
    "Creates aliases for layout builder paths like node/[id]/layout"

  • 🇳🇱Netherlands batigolix Utrecht
Production build 0.71.5 2024