Download the PHP package umanit/block-bundle without Composer

On this page you can find all versions of the php package umanit/block-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package block-bundle

Umanit Block Bundle

Doctrine Block managment made easy.

Philosophy

Usually when dealing with blocks, developers lose their database consistency because they have to store many block types in a single table. The most common way of storing many types of blocks in one single table is to store them in a json column.

We think json is bad for database consistency and performances. Searching, indexing, managing relations, primary and unique keys... You name it, none of them is possible with json.

UmanitBlockBundle intends to solve this problem by giving back their entities to the developers.

Front requirements

Install

Register the bundle to your config/bundles.php

Add one of the Twig's form theme

Add @umanit/block-bundle dev-dependency in your package.json. This part is automatically done if you use Flex in your projet.

Add stimulus controllers to your assets/controllers.json. This part is automatically done if you use Flex in your projet.

Don't forget to install the JavaScript dependencies as well and compile

Warning

Your Stimulus app must be running on your back end if you want to use this bundle: make sure the bootstrap.js file that starts it is imported. Your script must be loaded using encore_entry_script_tags().

Here are exemples on how to do that depending on your back end library, given an admin.js file on your end:

EasyAdmin 4

In your DashboardController, you can do it this way:

Sonata Admin 4

Configuration

You'll have to modify your webpack.config.js to allow your Stimulus controllers to work in your Sonata backend:

Usage

Terminology

Create an entity containing the Panel

Usually, you'll have a content entity (here we'll call it Page) having one or more Panels.

Next, use the provided PanelType form to administrate the Page content.

Every block manager is available by default, if you want to filter them, you can give an option authorized_blocks, an array of all the block types allowed to be selected, or unauthorized_blocks, an array of all the block types not allowed to be selected.

Read further for integration with EasyAdmin 4 and defining a PanelField in your CRUDController

Create a Block entity and its Block Manager

Start by creating your Block entity which should extends the bundle Block entity, like the following example:

Then, create a Block Manager service and its FormType which should extend AbstractBlockType. This service will define the form used to administrate your Block. It will also allow you to define the rendering of the Block in the front end.

Finally, tag your Block Manager with umanit_block.manager.

Render your blocks

Use the twig function umanit_block_render to render each of your blocks.

umanit_block_render will find the right BlockManager and call its render method.

You can pass an array of parameters to umanit_block_render. This parameters will be passed to the render method of the BlockManager.

Embedding a panel within a collection item

Block Bundle uses Stimulus, so you don't need to do anything on your end: controllers will be instantiated as they're added to the DOM.

Integration with UmanitTranslationBundle

This bundle is fully compatible with UmanitTranslationBundle. Once translating a Panel, all the Block instances and their properties will also be translated. If you need a locale parameter in you BlockManager form (to filter an EntityType for example), pass the parameter to the PanelType like so:

Integration with EasyAdmin 4

Registering the provided form theme

In your DashboardController:

Using the PanelField

If defining a CrudController, you can use the provided PanelField:

As with PanelType, you can define either authorized_blocks or unauthorized_blocks if you need to restrict the available block list to some chosen options.

Using a form type from EasyAdmin within a block

You might want to use FileUploadType, for example, in your blocks. Block Bundle only works with Symfony form types, which means you will not be able to use EA fields in them and leverage their powerful configurators. You can, however, still use the associated form type in your block form type but you might need to get your hands dirty with the options.

The block.js Stimulus controllers dispatches the ea.collection.item-added after a block has been added to the DOM, so EA JS will be bound to it.

CKEditor

Read the dedicated CKEditor documentation if you want to use it in your blocks


All versions of block-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
symfony/translation-contracts Version ^1.1|^2.3|^3.0
symfony/form Version ^4.4|^5.2|^6.0
symfony/framework-bundle Version ^4.4|^5.2|^6.0
symfony/validator Version ^4.4|^5.2|^6.0
doctrine/doctrine-bundle Version ^1.6|^2.1
doctrine/orm Version ^2.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umanit/block-bundle contains the following files

Loading the files please wait ....