PHPackages                             chauhan-mukesh/extended-block-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. chauhan-mukesh/extended-block-bundle

ActivePimcore-bundle[Database &amp; ORM](/categories/database)

chauhan-mukesh/extended-block-bundle
====================================

Pimcore bundle that extends block data type with separate table storage for better performance and queryability

020[1 PRs](https://github.com/Chauhan-Mukesh/extended-block/pulls)PHP

Since Feb 13Pushed 2mo agoCompare

[ Source](https://github.com/Chauhan-Mukesh/extended-block)[ Packagist](https://packagist.org/packages/chauhan-mukesh/extended-block-bundle)[ RSS](/packages/chauhan-mukesh-extended-block-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (29)Used By (0)

Extended Block Bundle for Pimcore
=================================

[](#extended-block-bundle-for-pimcore)

[![Latest Version](https://camo.githubusercontent.com/c3db4cacb3c5c0c506c6a1a1ecc27d65e70c594bbc4cf48bbb4649b52e7fca2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368617568616e2d6d756b6573682f657874656e6465642d626c6f636b2d62756e646c652e737667)](https://packagist.org/packages/chauhan-mukesh/extended-block-bundle)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/854124dd57cfd3aad3184fca9760bf1f33a5ec1e5d080cfbe8aa4e3337ba46e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d3838393242462e737667)](https://php.net/)[![Pimcore Version](https://camo.githubusercontent.com/4ddda2e59b691219b8aa297eeda7461e1b231ed230d63633354f287dd5f635d8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70696d636f72652d25334525334431302e302d3030414444382e737667)](https://pimcore.com/)

A Pimcore bundle that extends the block data type by storing data in separate database tables instead of serialized JSON in a single column. This provides better performance, queryability, and proper relational data modeling while maintaining the same UI/UX experience as Pimcore's native block field.

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Usage](#-usage)
- [PHP API](#-php-api)
- [Architecture](#-architecture)
- [Database Schema](#-database-schema)
- [Field Restrictions](#-field-restrictions)
- [Block Nesting Rules](#-block-nesting-rules)
- [API Reference](#-api-reference)
- [Testing](#-testing)
- [Troubleshooting](#-troubleshooting)
- [Contributing](#-contributing)
- [License](#-license)
- [Documentation](#-documentation)

✨ Features
----------

[](#-features)

- **Separate Table Storage**: Each extended block stores data in dedicated database tables, similar to field collections
- **SQL Queryable**: Unlike standard blocks that use serialized JSON, extended block data can be queried using SQL
- **Better Performance**: Eliminates serialization overhead and enables efficient database queries
- **Pimcore-style UI/UX**: Follows Pimcore's native block UI patterns with inline controls (add before/after, delete, move up/down)
- **Responsive Design**: Fully responsive interface with auto-adjusting height/width, transitions, and animations
- **Multiple Block Types**: Define multiple block types with different field configurations
- **Nesting Prevention**: Automatic validation prevents invalid block nesting configurations
- **Safe Schema Updates**: New fields can be added without data loss; removed fields preserve existing data
- **Lazy Loading**: Optional lazy loading for improved performance with large datasets
- **Dark Mode Support**: CSS supports dark mode when the browser prefers dark color scheme

📦 Requirements
--------------

[](#-requirements)

- PHP 8.0 or higher
- Pimcore 10.0 or higher (supports Pimcore 10.x and 11.x)
- Symfony 5.4 or higher (5.x for Pimcore 10, 6.x for Pimcore 11)

🚀 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

**Option A: Install from Packagist (if published)**

```
composer require chauhan-mukesh/extended-block-bundle
```

**Option B: Install from GitHub repository**

If the package is not yet available on Packagist, or you want to install directly from GitHub, add the repository to your `composer.json`:

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/Chauhan-Mukesh/extended-block"
        }
    ]
}
```

Then run:

```
composer require chauhan-mukesh/extended-block-bundle:dev-main
```

> **Note:** When installing from GitHub, you may need to set `"minimum-stability": "dev"` in your `composer.json` or use `@dev` version constraint if no stable releases are tagged.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Add the bundle to your `config/bundles.php`:

```
return [
    // ... other bundles
    ExtendedBlockBundle\ExtendedBlockBundle::class => ['all' => true],
];
```

### Step 3: Install the Bundle

[](#step-3-install-the-bundle)

Run the installer to set up required database tables:

```
bin/console pimcore:bundle:install ExtendedBlockBundle
```

### Step 4: Publish Assets

[](#step-4-publish-assets)

```
bin/console assets:install public --symlink
```

⚙️ Configuration
----------------

[](#️-configuration)

Configure the bundle in `config/packages/extended_block.yaml`:

```
extended_block:
    # Prefix for database tables (default: 'object_eb_')
    table_prefix: 'object_eb_'

    # Enable strict validation mode (default: true)
    strict_mode: true

    # Maximum items per block (null for unlimited)
    max_items: null

    # Enable query logging for debugging (default: false)
    debug_queries: false
```

📖 Usage
-------

[](#-usage)

### Adding ExtendedBlock to a Class Definition

[](#adding-extendedblock-to-a-class-definition)

1. Open the Pimcore Admin panel
2. Navigate to **Settings &gt; Data Objects &gt; Classes**
3. Select or create a class
4. Add a new field by right-clicking in the tree and selecting **Extended Block** from the **Structured** data types section
5. Configure the field settings (name, title, min/max items, etc.)
6. Add sub-fields by right-clicking on the ExtendedBlock field and selecting the desired field type

### Adding Sub-fields

[](#adding-sub-fields)

ExtendedBlock follows Pimcore's standard Block pattern for adding sub-fields:

1. Right-click on the ExtendedBlock field in the class definition tree
2. Select **"Add data component"** from the context menu
3. Choose a field type from the submenu (grouped by category: text, numeric, date, etc.)
4. Configure the field settings in the right panel

> **Note:** The context menu will show "Add data component" with grouped field types. Not all field types are available - complex nested types like LocalizedFields, Block, FieldCollections, ObjectBricks, and ExtendedBlock cannot be added inside ExtendedBlock.

**Example structure:**

```
MyExtendedBlock (ExtendedBlock)
├── title (Input)
├── content (WYSIWYG)
├── description (Textarea)
└── image (Image)

```

### Supported Field Types

[](#supported-field-types)

The following field types can be added as sub-fields:

**Text &amp; Content:**

- Input, Textarea, WYSIWYG, Email

**Numeric &amp; Selection:**

- Numeric, Checkbox, Slider, BooleanSelect
- Select, Multiselect
- Country, Country Multiselect
- Language, Language Multiselect, Gender

**Date &amp; Time:**

- Date, DateTime

**Relations (simple reference storage):**

- ManyToOneRelation
- ManyToManyRelation
- ManyToManyObjectRelation

**Assets:**

- Image, Link

> **Note:** Relation fields store element references (ID + type) in the ExtendedBlock table. Advanced relation types with metadata (AdvancedManyToManyRelation, AdvancedManyToManyObjectRelation) and ReverseObjectRelation are not supported.

### Defining Block Types

[](#defining-block-types)

In the class editor, you can define multiple block types, each with its own set of fields:

```
Block Type: text_block
├── title (Input)
├── content (WYSIWYG)
└── description (Textarea)

Block Type: image_block
├── image (Image)
├── caption (Input)
└── link (Link)

```

### Working with Extended Block Data

[](#working-with-extended-block-data)

```
