Use Tokens in Path

Created on 29 April 2024, about 1 year ago
Updated 30 July 2024, 10 months ago

Would it be possible to have the ability to add tokens in to the path for the D10 version of this module? I know it was included for Drupal 7. Thanks!

Feature request
Status

Active

Version

10.0

Component

Code

Created by

🇬🇧United Kingdom bmango

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bmango
  • First commit to issue fork.
  • Merge request !17Issue:3444201 - Use Tokens in Path → (Open) created by vinmayiswamy
  • Pipeline finished with Success
    10 months ago
    Total: 172s
    #238037
  • 🇮🇳India vinmayiswamy

    Hi, I have created MR!17 for this feature request. This MR introduces updates to the front_page module's configuration form. The changes focus on improving the handling of token replacements in redirect paths and enhancing the codebase by following Drupal best practices.

    Key Changes

    Token Integration:
    - Added support for token replacement in the front page path settings. Users can now use tokens like [node:title] in the path fields, and these tokens will be replaced correctly when saving the settings.

    Form Enhancements:
    - Added token help to all path fields to guide users on using tokens effectively.
    - Improved form validation to ensure that a path is provided when redirection is enabled for a role.
    - Integrated token help UI using token_tree_link to assist users with token insertion.

    Code Quality and Refactoring:
    - Refactored code to use dependency injection instead of direct service calls (\Drupal::service(), \Drupal::moduleHandler(), etc.).
    - Cleaned up deprecated code and improved overall readability.

    Testing Instructions

    Verify Token Functionality:
    - Ensure that token help is visible and functional for all path fields in the configuration form.
    - Confirm that tokens in paths are replaced correctly when the form is submitted.

    Form Validation:
    - Validate that errors are displayed if a path is missing for roles with redirection enabled.

    Code Quality:
    - Verify that the code uses dependency injection properly and that deprecated service calls have been replaced.

    Additional Notes
    - Ensure that the Token module is enabled to fully test token-related functionality.
    - Review changes for any potential impact on other modules or configurations.

    Thanks!

  • Status changed to Needs review 10 months ago
  • 🇮🇳India vinmayiswamy

    Kindly please review.

  • 🇧🇪Belgium flyke

    Patch does not apply in 10.0@alpha2, BUT, I tested using a token in /admin/config/system/front/home-links and it works without a patch.

Production build 0.71.5 2024