-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #1214 Allow to create complex form layouts (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #1214). Discussion ---------- Allow to create complex form layouts ### Context These past days I had to use Magento 2. I liked how they present the forms in their backend, so I want to make EasyAdmin capable of creating similar layouts: ![magento_form](https://cloud.githubusercontent.com/assets/73419/16241664/03042e84-37ef-11e6-986e-ff0bb66e7008.png) ### Solution I propose to define three new design elements for forms: "dividers", "fieldsets" and "sections" (names are temporary). 1) A `divider` is just a `<hr>` 2) A `section` is similar to the Magento design: ![fieldset](https://cloud.githubusercontent.com/assets/73419/16241835/cd3e7f60-37ef-11e6-890c-5077c7fefb47.png) 3) A `group` is what Sonata calls `groups`: (the screenshot is not great, but this is a really nice Sonata feature; it's very useful and for real forms it looks beautiful) ![sonata_form](https://cloud.githubusercontent.com/assets/73419/16241848/e20c3950-37ef-11e6-97bf-24a3e0c54a74.png) ### Proposal This PR contains: * A first draft of the docs to explain this new feature * A silly proof of concept to implement the "divider" type. Commits ------- 2c7e2dc Allow to create complex form layouts
- Loading branch information
Showing
167 changed files
with
1,423 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace JavierEguiluz\Bundle\EasyAdminBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
/** | ||
* The 'divider' form type is a special form type used to display a design | ||
* element needed to create complex form layouts. This "fake" type just displays | ||
* some HTML tags and it must be added to a form as "unmapped" and "non required". | ||
*/ | ||
class EasyAdminDividerType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockPrefix() | ||
{ | ||
return 'easyadmin_divider'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->getBlockPrefix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace JavierEguiluz\Bundle\EasyAdminBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
/** | ||
* The 'group' form type is a special form type used to display a design | ||
* element needed to create complex form layouts. This "fake" type just displays | ||
* some HTML tags and it must be added to a form as "unmapped" and "non required". | ||
*/ | ||
class EasyAdminGroupType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockPrefix() | ||
{ | ||
return 'easyadmin_group'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->getBlockPrefix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace JavierEguiluz\Bundle\EasyAdminBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
/** | ||
* The 'section' form type is a special form type used to display a design | ||
* element needed to create complex form layouts. This "fake" type just displays | ||
* some HTML tags and it must be added to a form as "unmapped" and "non required". | ||
*/ | ||
class EasyAdminSectionType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockPrefix() | ||
{ | ||
return 'easyadmin_section'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->getBlockPrefix(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.