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

Generic Dropdowns #17603

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

Conversation

cconard96
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -

Intended to be integrated with custom fields for generic assets in a future PR.
PR also generalizes the generic asset code to de-duplicate the work between generic assets and generic dropdowns.

Generic dropdowns may optionally be "tree" dropdowns instead of flat ones. This can be changed at any time. When not in tree mode, the items are added at level 0 with the complete name set properly as if they were root items. The base class switches between CommonDropdown and CommonTreeDropdown depending on the value of is_tree in the definition.

Being based on the standard dropdown classes, these custom ones are obviously translatable in the same way.

@cconard96 cconard96 self-assigned this Jul 29, 2024
@cconard96 cconard96 marked this pull request as ready for review July 30, 2024 00:14
Copy link
Contributor

@orthagh orthagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to test this one as well but as we (once again) are late on review, I thikg it's not up to date with the last evolution of generic routes for dropdown (#17454), no?

@cconard96
Copy link
Contributor Author

I wanted to test this one as well but as we (once again) are late on review, I thikg it's not up to date with the last evolution of generic routes for dropdown (#17454), no?

I think it needs a new route. Custom Asset types and models aren't handled by the new controller either.

@cedric-anne
Copy link
Member

I wanted to test this one as well but as we (once again) are late on review, I thikg it's not up to date with the last evolution of generic routes for dropdown (#17454), no?

I think it needs a new route. Custom Asset types and models aren't handled by the new controller either.

They are mapped with the generic dropdown controllers here:

if ($asset_model_class = $this->findAssetModelclass($request)) {
return $this->normalizeClass($asset_model_class);
}
if ($asset_type_class = $this->findAssetTypeclass($request)) {
return $this->normalizeClass($asset_type_class);
}

cconard96 and others added 2 commits September 19, 2024 16:35
 - Mutualize some code
 - Extends CommonTreeDropdown everytime
 - Put back `getAssetClassName()` to reduce diff
 - Add default SO
 - ...
Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes. Most important is that all custom dropdown are tree dropdowns, as it permits to simplify the code. I validated this change with @orthagh.

I did not had time to pass the whole test suite. If tests fails, I will fix them.

@cedric-anne cedric-anne added this to the 11.0.0 milestone Sep 19, 2024
@cconard96
Copy link
Contributor Author

Most important is that all custom dropdown are tree dropdowns

Disagree with that change but not willing to argue. Will wait and see if any users provide feedback about that forced behavior.

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