agence-adeliom / easy-gutenberg-bundle
A Symfony bundle for EasyAdmin that provide a flexible content editor
Installs: 78
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.0.2
- ext-json: *
- agence-adeliom/easy-common-bundle: ^2.0.53
- agence-adeliom/easy-fields-bundle: ^2.0.53
- easycorp/easyadmin-bundle: ^3.4 || ^v4.0
- embed/embed: ^4.2
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/deprecation-contracts: ^2.2 || ^v3.0
- symfony/event-dispatcher: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/framework-bundle: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/options-resolver: ^5.4 || ^6.0
- symfony/property-access: ^5.4 || ^6.0
- 2.x-dev
- 2.0.53
- 2.0.52
- 2.0.49
- 2.0.48
- 2.0.47
- 2.0.46
- 2.0.45
- 2.0.44
- 2.0.43
- 2.0.42
- 2.0.41
- 2.0.40
- 2.0.39
- 2.0.38
- 2.0.37
- 2.0.36
- 2.0.35
- 2.0.34
- 2.0.33
- 2.0.32
- 2.0.31
- 2.0.30
- 2.0.29
- 2.0.28
- 2.0.27
- 2.0.26
- 2.0.25
- 2.0.24
- 2.0.23
- 2.0.22
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- dev-main
This package is auto-updated.
Last update: 2023-01-30 16:15:43 UTC
README
Easy Gutenberg Bundle
Provide Wordpress's Gutenberg Editor into Easyadmin.
Versions
Repository Branch | Version | Symfony Compatibility | PHP Compatibility | Status |
---|---|---|---|---|
2.x |
2.x |
5.4 , and 6.x |
8.0.2 or higher |
New features and bug fixes |
Installation with Symfony Flex
Add our recipes endpoint
{ "extra": { "symfony": { "endpoint": [ "https://api.github.com/repos/agence-adeliom/symfony-recipes/contents/index.json?ref=flex/main", ... "flex://defaults" ], "allow-contrib": true } } }
Install with composer
composer require agence-adeliom/easy-gutenberg-bundle
Documentation
Use GutenbergField
Go to your crud controller, example : src/Controller/Admin/PageCrudController.php
<?php namespace App\Controller\Admin; ... use App\Entity\EasyFaq\Entry; use App\Entity\EasyFaq\Category; abstract class PageCrudController extends AbstractCrudController { ... public function configureCrud(Crud $crud): Crud { return parent::configureCrud($crud) // Add the form theme ->addFormTheme('@EasyGutenberg/form/gutenberg_widget.html.twig') ; } public function configureFields(string $pageName): iterable { ... yield GutenbergField::new("content"); ...
Create a new Block
php bin/console make:gutenberg
Then setup your form field
<?php namespace App\Blocks; use Adeliom\EasyGutenbergBundle\Blocks\AbstractBlockType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; class TwoColsType extends AbstractBlockType { public function buildBlock(FormBuilderInterface $builder, array $options): void { $builder->add("left_col", TextType::class, ["label" => 'Left column content']); $builder->add("right_col", TextType::class, ["label" => 'Right column content']); } public static function getName(): string { return 'Two columns'; } public static function getDescription(): string { return 'Make a two columns layout'; } public static function getIcon(): string { return ''; } public static function getTemplate(): string { return "blocks/two_cols.html.twig"; } }
Frontend usage
In your template you can use these functions :
# This convert and render the content {{ easy_gutenberg(page.content) }} # This render the blocks's assets must be called after 'easy_gutenberg' {{ easy_gutenberg_assets() }}
Extra features
Add frontend assets
public static function configureAssets(): array { return [ 'js' => [], 'css' => [], 'webpack' => [], ]; }
Add backend assets
public static function configureAdminAssets(): array { return [ 'js' => [], 'css' => [], ]; }
Add extra form themes
public static function configureAdminFormTheme(): array { return []; }
Specify a category
The provided categories are:
- common
- text
- media
- design
- widgets
- theme
- embed
public static function getCategory(): string { return 'common'; }
Specify variations
public static function getVariations(): array { return [ [ "name": 'variation_with_bg', "isDefault": true, "title": "Variation With background", "icon": '', "attributes": [ "with-bg": true ], ] ]; }
Specify extra attributes
public static function getAttributes(): array { return [ "with-bg" => ['type' => 'boolean'] ]; }
Specify supports
Allowed supports are :
public static function getSupports(): array { return array_merge(parent::getSupports(),[ 'align' => false, ]); }