Keep only common option in FieldDescriptionOptions type#7103
Keep only common option in FieldDescriptionOptions type#7103VincentLanglet merged 3 commits intosonata-project:3.xfrom VincentLanglet:removeOptions
Conversation
|
you are right, I don't agree with this, I think we are missing information and going backwards, if we need more options we can add them, if we want to allow users to add any option (not documented), we should add an option for that, otherwise it's a mess. Anyway, I do not tend to block things because it's my opinion and I might be wrong, so if there are people that agree with this I'm fine. |
|
IMO if it causes some kind of regression to current code or we are not all agree with that type, we should first revert it and have green builds again. And then discuss about how this can be done. |
|
But it's not because of this that test are not passing, it is after the addition of https://github.com/sonata-project/SonataAdminBundle/pull/7040/files#diff-dba1a2c25ea11b814213238e6c62006084f246e9be5cd8ca251b4f9a65a3a292R56 and the upgrade of phpstan (they can be ignored too) |
|
Then it would fall under the "we are not all agree this is the correct move". We should agree on: Maybe this is a good move, but the current code does not reflects this behavior, and must be changed before enforcing some options that are not realistic. wdyt? |
|
From the slack discussion:
Type-specific options like |
|
I made some research about the current typed options: IMHO:
|
| 'linkParameters': sonata_admin.field_description.option('link_parameters', {}) | ||
| })) }} | ||
| {% elseif sonata_admin.field_description.option('placeholder') %} | ||
| {% elseif sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder') %} |
There was a problem hiding this comment.
this can't be correct, otherwise it is an always true if and can be removed with just else
There was a problem hiding this comment.
To disabled the placeholder, 'false' should be use.
| 'linkParameters': sonata_admin.field_description.option('link_parameters', {})) | ||
| })) }} | ||
| {% elseif sonata_admin.field_description.option('placeholder') %} | ||
| {% elseif sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder') %} |
|
|
||
| // set default placeholder | ||
| // NEXT_MAJOR: Remove this. | ||
| if (!isset($options['placeholder'])) { |
There was a problem hiding this comment.
if not set, it will set a default, but if it is set to null, it won't, I think the new behavior you implemented don't cover this case
There was a problem hiding this comment.
isset(null) is false. So null wasn't the way to disable the placeholder. false is the way.
|
Could you please rebase your PR and fix merge conflicts? |
|
I'll try to fix the psalm issue with empty array vimeo/psalm#5677 |
|
Use both |
| * - type (m): define the field type (use to tweak the form or the list) | ||
| * - template (o) : the template used to render the field | ||
| * - name (o) : the name used (label in the form, title in the list) | ||
| * - link_parameters (o) : add link parameter to the related Admin class when |
There was a problem hiding this comment.
Apparently link_parameters it us used in the route generator, so I guess is kind of global:
| * - associated_tostring : (deprecated, use associated_property option) | ||
| * the method to retrieve the "string" representation | ||
| * of the collection element. | ||
| * - associated_property : property path to retrieve the "string" representation |
There was a problem hiding this comment.
associated_property it is used in RenderElementExtension which means it is used in render_relation_element Twig filter that it is used globally: https://github.com/sonata-project/SonataAdminBundle/search?q=render_relation_element
Subject
Follow up of the discussion
#7101
This type is currently not describing correctly the possible options ATM.
Since @franmomu is not agreeing with this, I prefer to wait for his approval before any merge.
Changelog