Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dropdown comments handling #17981

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

cedric-anne
Copy link
Member

@cedric-anne cedric-anne commented Oct 1, 2024

Checklist before requesting a review

  • 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.

Description

I extracted the comments computation from the Dropdown::getDropdownName() method and move it into a Dropdown::getDropdownComments() in order to not have a mix between raw data and HTML encoded data in the same method result.

  • Dropdown::getDropdownName() will now always return a raw value.
  • Dropdown::getDropdownComments() will always return a safe HTML string.

@trasher
Copy link
Contributor

trasher commented Oct 30, 2024

HTML generation should be done from Twig, I do not really understand why keeping that PHP side finally.

@cedric-anne
Copy link
Member Author

HTML generation should be done from Twig, I do not really understand why keeping that PHP side finally.

Just because I did not take time to do it, but indeed, it is better to do it using a Twig template.

@trasher trasher merged commit 5c684ce into glpi-project:main Oct 31, 2024
7 checks passed
@cedric-anne cedric-anne deleted the 11.0/dropdown-comments branch October 31, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants