Demo GIF
composer require customberg/customberg-phpAdd vendor files to your project (CSS, JS, Config, Views):
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider"
php artisan vendor:publish --provider="Customberg\PHP\CustombergServiceProvider"The model that you want to use this block editor should have:
use VanOns\Laraberg\Traits\RendersContent;
class Page extends Model
{
use RendersContent;
}In the backpack crud controller you must create the crud field like this:
CRUD::field('content')
->label('Page content')
->type('customberg')
->view_namespace('customberg::');Create a new block with the make:block command:
php artisan make:block AwesomeBlockThen edit the block field definition in app/Blocks/AwesomeBlock.php file, and the block view in resources/views/blocks/cb-awesome-block.blade.php.
Checkout /example/app/Blocks/EverySingleField.php for a full example with every field type.
After an update, get the latest assets using:
# update source
composer require customberg/customberg-php
# update public assets
php artisan vendor:publish --tag="customberg-assets" --force
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider" --tag="public" --forcegit clone https://github.com/customberg/customberg-php
cd customberg-php/example
docker compose up -d
docker compose exec php su app -c 'cd example; composer install'
docker compose exec php su app -c 'cd example; cp .env.example .env; php artisan key:generate'
docker compose exec nginx su app -c 'cd /app/example/public/; ln -s ../storage/app/public storage'Navigate to http://localhost:8084 and press login.
Enjoy !
| ✅ | A checkbox field |
| ✅ | A custom js field |
| ☐ | Switch field |
| ☐ | Radio field |
| ☐ | Slider field |
| ☐ | Google Maps field |
| ☐ | Documentation ! |
| ☐ | Icon picker field |
- Replace str_replace_limit implementation because there is a character limit error
- New field type:
customfor custom js field with React.createElement - Checkout /example/app/Blocks/CustomField.php for an example with summernote for Backpack V5 (TODO: update to V6)
- New field types:
checkbox,textarea,number,email,url - New property
placeholderfor text fields - New property
hintandhint_htmlfor all fields that show a small helper text - Checkout /example/app/Blocks/EverySingleField.php for a full example
- Bugfix: Preview API while rendering a block with multilanguage, when i'm selecting the new language that does not have translation saved.
- Allow laravel 11 installation
- Bugfix error cannot redeclare str_replace_limit
- Update requirements to laravel 10
- Added file extension validation to
upload_image.
Use'allowed_types' => ['png', 'jpg', 'webp', 'svg'], - Added
upload_filefor files without preview.
Use'multiple' => true,if you want multiple files in the same field.
- Multilanguage fine tuning, made configurable language list and bugfixing
- Multilanguage only supports fields
textandrich_text, and works inside repeatable field.
- Fine tuning for repeatable field frontend
- Added buttons to move and duplicate a item inside repeatable
- Added example block for repeatable
- First version published to packagist.org ! 🎉🥳
- Only available fields are:
text, rich_text, color, upload_image - Repeatable is present but untested. Multilanguage present but untested and hardcoded.
