Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hpodevteam/pagebundle
This bundle is used to create section page with EasyAdmin > 3
https://github.com/hpodevteam/pagebundle
doctrine orm symfony symfony-bundle
Last synced: 24 days ago
JSON representation
This bundle is used to create section page with EasyAdmin > 3
- Host: GitHub
- URL: https://github.com/hpodevteam/pagebundle
- Owner: Hpodevteam
- Created: 2022-05-14T13:26:45.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2022-09-15T15:53:48.000Z (over 2 years ago)
- Last Synced: 2024-12-16T03:10:48.219Z (24 days ago)
- Topics: doctrine, orm, symfony, symfony-bundle
- Language: PHP
- Homepage:
- Size: 2.91 MB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Page-bundle
## Installation
```bash
composer require "hpodevteam/page-bundle"
```## Configuration
Open your ```config/packages/page.yaml``` file and add :
```yaml
page:
sections:
spacer: 'your spacing class'
colors:
color1:
name: 'Your color name'
value: '#fff'
# You can set other colors
```Open your ```config/packages/vich_uploader.yaml``` file and add :
```yaml
parameters:
app.path.section_image: /uploads/section_imagevich_uploader:
mappings:
section_image:
uri_prefix: '%app.path.section_image%'
upload_destination: '%kernel.project_dir%/public/uploads/section_image'
namer: Vich\UploaderBundle\Naming\OrignameNamer```
## Usage
Add trait ```SectionWidget``` to the entity to be managed.
```php
id;
}//
}
```Then in ```{YourEntity}CrudController.php``` file
```php
overrideTemplates([
'crud/edit' => '@Page/admin/entity/edit.html.twig',
'crud/new' => '@Page/admin/entity/new.html.twig'
])
// This is mandatory
->setFormThemes(['@Page/admin/section/form_theme.html.twig'])
;
}
// Optionnal for tabs
// This allow you to redirect to parent instead of getting redirected to Crud::INDEX page
public function getRedirectResponseAfterSave(AdminContext $context, string $action): RedirectResponse
{
$submitButtonName = $context->getRequest()->request->all()['ea']['newForm']['btn'];if (Action::SAVE_AND_RETURN === $submitButtonName) {
$url = $this->get(AdminUrlGenerator::class)
->setController('Entity\\To\\Redirect')
->setAction(Action::EDIT)
->setEntityId($yourEntityId);return $this->redirect($url);
}return parent::getRedirectResponseAfterSave($context, $action);
}
}
```