[FEATURE] #4725 Add Form Tabs support #4727
[FEATURE] #4725 Add Form Tabs support #4727jeromeengeln wants to merge 27 commits intoEasyCorp:masterfrom
Conversation
Due to doctrine/orm > 2.10.0 (added in composer.json conflicts)
|
@JeromeEngelnAdeliom do you have some visual for this feature ? |
|
@john-dufrene-dev I used the existing bootstrap template : |
|
@JeromeEngelnAdeliom excellent ! Hope to see this New feature |
parijke
left a comment
There was a problem hiding this comment.
I cannot see why the composer.json should be changed
|
It was my way to pass the commit's checks. The problem is linked to doctrine/orm 2.10.0 + that allow doctrine/dbal 3 since 3 days. |
|
@JeromeEngelnAdeliom thanks for working on this. I want this feature to be added as soon as possible, but I'm lacking the energy to work on this ... so your PR is what we need to move this forward. As you probably know, we already had this feature in 2.x branch, but we had to remove it in order to release the 3.x version without much delay.
Thanks! |
|
Thanks for your comment. |
|
Ok I see your point. My test has worked only when the submit action was triggered. I will try to add the old js code for front-end validation errors. |
|
@javiereguiluz I made some changes to answer to your third point. Can you check ? |
|
I've added this as a patch to my dev env but I don't see the tabs? No errors shown. |
To verify, I've removed all my changes from my vendor test project directory and re added then pull PR 4727 directly in vendor/easycorp/easyadmin-bundle. Works fine for me after adding : public function configureFields(string $pageName): iterable
{
yield FormField::addTab('Tab');Can you tell me more ? |
|
I have patched easyadmin using: which added the addTab method (which I can add to my crudController without problems). It won't show in the front end though. |
|
Very strange, I've tried your method with patches. Works fine in my project. Gathering patches for dependencies. This might take a minute.
- Installing easycorp/easyadmin-bundle (v3.5.10): Extracting archive
- Applying patches for easycorp/easyadmin-bundle
https://patch-diff.githubusercontent.com/raw/EasyCorp/EasyAdminBundle/pull/4727.patch (tabs feature)
Can try a dump in vendor/easycorp/easyadmin-bundle/src/Resources/views/crud/form_theme.html.twig : {# EasyAdmin form type #}
{% block ea_crud_widget %}
{{ dump(ea_crud_form.form_tabs) }}
{% if ea_crud_form.form_tabs|length > 0 %}Or share me your dev project to investigate more ? Or show me your configureFields() method ? |
|
Damn me... sorry I've wasted your time... It appears ONLY to work on edit/new (Forms) and I was constantly checking the DETAIL page It works on the forms |
|
Ok np, I excluded the detail page as it needs some twig adjustments. |
|
Hi, is there any way to "close" a tab so some other fields can be added after the tabs? |
|
I have found a issue when you add some fields inside a tab and not wrapped in a panel : 9bda3d5 fixed this wrong behavior : |
Can you tell me more about your idea ? I think that if you want to use tabs it for to put all your fields inside. |
That's just an example of what I'd do: put some fields on top and/or bottom of the tabs content. An other example would be translations: I'd have some tabs for each translation, but some fields wouldn't be translated (eg. price, weight...). |
|
That kind of integration can be added after this PR ? But I agree, having many tabs section in one page (or a static bottom field list) can be useful. |
# Conflicts: # assets/css/easyadmin-theme/forms.scss
# Conflicts: # assets/css/easyadmin-theme/forms.scss # src/Resources/public/app.css # src/Resources/public/app.js # src/Resources/public/app.rtl.css
jeromeengeln
left a comment
There was a problem hiding this comment.
Job done since beginning :
- Add tab support
- Add some javascript to intercept tabs errors when submitting a form
- Display an error counter directly inside tabs
- Manage recent conflicts
- Adjust nav-tabs container margin top
|
Is there any task left or help needed ? |
|
Maybe some advanced tests or some UI adaptations (maybe after this PR as javiereguiluz said above "I have some clear ideas about the UI design of this feature and I'd like to make some changes in your PR") ? |
|
I use this PR as a patch in my dev project since 2 month without encountering any problems. |
|
Jérôme, I apologize to you for not having merged your contribution earlier. I just did, so I can only send you a BIG THANK YOU for having implemented this feature. It will be available in the next stable release. Thanks! |
…iom) This PR was submitted for the master branch but it was squashed and merged into the 3.x branch instead. Discussion ---------- [FEATURE] #4725 Add Form Tabs support [3.X] Add Form Tabs support #4725 ### Add feature to support form tabs on cruds I've found a rapid way to make it works. What do you think about it ? Example of how to use this feature _ In pages where you display lots of fields, you can divide them in tabs using the "tabs" created with the special FormField object:: ```php use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; public function configureFields(string $pageName): iterable { return [ IdField::new('id')->hideOnForm(), // Add a tab FormField::addTab('First Tab'), // You can use a Form Panel inside a Form Tab FormField::addPanel('User Details'), // Your fields TextField::new('firstName'), TextField::new('lastName'), // Add a second Form Tab // Tabs can also define their icon, CSS class and help message FormField::addTab('Contact information Tab') ->setIcon('phone')->addCssClass('optional') ->setHelp('Phone number is preferred'), TextField::new('phone'), ]; } ``` _ Commits ------- ac0dec4 [FEATURE] #4725 Add Form Tabs support






[3.X] Add Form Tabs support #4725
Add feature to support form tabs on cruds
I've found a rapid way to make it works.
What do you think about it ?
Example of how to use this feature
_
In pages where you display lots of fields, you can divide them in tabs using
the "tabs" created with the special FormField object::
_