hpodevteam / page-bundle
There is no license information available for the latest version (v1.6.0) of this package.
v1.6.0
2022-09-15 15:49 UTC
Requires
- php: >=7.4
- doctrine/annotations: ^1.13
- doctrine/doctrine-bundle: ^2.2
- doctrine/doctrine-migrations-bundle: ^3.0
- doctrine/orm: ^2.8
- easycorp/easyadmin-bundle: ^3.5
- friendsofsymfony/ckeditor-bundle: 2.4
- gedmo/doctrine-extensions: ^3.0
- symfony/asset: ^4.4|^5.0
- symfony/console: ^5.4
- symfony/framework-bundle: ^5.4|^6.0
- symfony/twig-bundle: ^5.4
- symfony/webpack-encore-bundle: ^1.14
- vich/uploader-bundle: ^1.19
- dev-develop
- v1.6.0
- v1.5.24
- v1.5.23
- v1.5.22
- v1.5.21
- v1.5.20
- v1.5.19
- v1.5.18
- v1.5.17
- v1.5.16
- v1.5.15
- v1.5.14
- v1.5.13
- v1.5.12
- v1.5.11
- v1.5.10
- v1.5.9
- v1.5.9-beta
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.3.0
- v1.2.2
- v1.2.1
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- 1.0.7
- v1.0.6
- v1.0.5
- 1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-main
- dev-fix/supp
- dev-feature/ux-ui-feature
- dev-fix/barcharty
This package is auto-updated.
Last update: 2025-03-28 21:25:39 UTC
README
Installation
composer require "hpodevteam/page-bundle"
Configuration
Open your config/packages/page.yaml
file and add :
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 :
parameters: app.path.section_image: /uploads/section_image vich_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 namespace App\Entity; use App\Repository\PageRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Hippocampe\Bundle\PageBundle\Traits\SectionWidget; /** * @ORM\Entity(repositoryClass=PageRepository::class) */ class Page { use SectionWidget; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; // public function getId(): ?int { return $this->id; } // }
Then in {YourEntity}CrudController.php
file
<?php namespace App\Controller\Admin; use App\Entity\Page; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\CollectionField; use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use Hippocampe\Bundle\PageBundle\Form\Admin\Type\SectionRowType; class PageCrudController extends AbstractCrudController { public static function getEntityFqcn(): string { return Page::class; } public function configureCrud(Crud $crud): Crud { return $crud // You can use your own templates here and extends @Page/admin/entity/{actions}.html.twig ->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); } }