Skip to content

Conversation

RomainLvr
Copy link
Contributor

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !39546
  • Here is a brief description of what this PR does

Add new Twig variables for content templates

This PR introduces three new template variables to enhance content template capabilities:

Asset variables:

  • {{ asset.model }} - Returns the asset's model name (e.g., "Dell OptiPlex")
  • {{ asset.state }} - Returns the asset's current state (e.g., "In service", "Broken")

User variable:

  • {{ user.registration_number }} - Returns the user's administrative/employee number

Changes:

  • Updated AssetParameters.php to fetch model via getModelClass() and state via State class
  • Updated UserParameters.php to include registration number from user fields
  • Added comprehensive test coverage for all new variables
  • Updated existing tests to handle new user parameter in ITIL objects

Screenshots (if appropriate):

image image

@RomainLvr RomainLvr self-assigned this Oct 14, 2025
@RomainLvr RomainLvr requested review from Rom1-B and stonebuzz October 14, 2025 13:30
@RomainLvr RomainLvr force-pushed the feat/content-templates-new-variables branch from 94310f9 to 50208f6 Compare October 14, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants