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

Itilobject_item showListForitem twig update #17910

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Lainow
Copy link
Contributor

@Lainow Lainow commented Sep 23, 2024

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

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):

@Lainow Lainow self-assigned this Sep 23, 2024
Comment on lines +66 to +71
{{ 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 }}
Copy link
Member

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.

Copy link
Contributor

@cconard96 cconard96 Sep 30, 2024

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.

Copy link
Contributor

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.

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.

3 participants