-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Itilobject_item showListForitem twig update #17910
base: main
Are you sure you want to change the base?
Itilobject_item showListForitem twig update #17910
Conversation
{{ call(itemtype_1 ~ '::commonListHeader', [html_output])|raw }} | ||
{% for data in iterator %} | ||
{{ call('Session::addToNavigateListItems', [itemtype_1, data["id"]])|raw }} | ||
{{ call(itemtype_1 ~ '::showShort', [data["id"]])|raw }} | ||
{% endfor %} | ||
{{ call(itemtype_1 ~ '::commonListHeader', [html_output])|raw }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not try to see how it can be done differently, but if you have to call so many PHP methods to render the page, there is no real value to use Twig for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the datatable template? ITILObject class has getCommonDatatableColumns()
which is the alternative to commonListHeader
which returns the column and formatter arrays needed for the datatable.
Edit: See getDatatableEntries
also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the other converted sublists (or at least most of them) do not handle addToNavigateListItems
calls at all. The feature could be useful to some, but its implementation seems very error-prone because of how it is stored directly in the session. Navigating multiple lists of the same itemtype in multiple tabs and lists of mixed itemtypes don't seem supported at all.
Checklist before requesting a review
Please delete options that are not relevant.
Description
Passage of the code for displaying the list of items linked to an Itil object in twig as requested on the PR: #17680
Screenshots (if appropriate):