PHPackages                             oro/layout - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. oro/layout

Abandoned → [oro/platform](/?search=oro%2Fplatform)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

oro/layout
==========

Oro Layout Component

10PHP

Since Apr 26Pushed 8y ago40 watchersCompare

[ Source](https://github.com/oroinc/OroLayoutComponent)[ Packagist](https://packagist.org/packages/oro/layout)[ RSS](/packages/oro-layout/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Oro Layout Component
====================

[](#oro-layout-component)

Oro Layout component defines the object-oriented presentation of a page structure and provides tools to build, manage, and render the page.

**IMPORTANT**: This component is not finished yet.

`Oro Layout Component` provides tools for:

- defining the elements of the layout (blocks) that can be used to build different types of layouts, including HTML, XML, etc.
- managing the layout structure and themes.

Introduction
------------

[](#introduction)

Before you begin working with layout, make sure you are familiar with the following key `Oro Layout Component` concepts:

- A layout is a set of widgets that are arranged in a hierarchical structure, where a widget is a logical block that contains certain content.
- Neither the layout nor a widget know how they should be converted (or in other words, rendered) into the output string (e.g. HTML). To make this conversion, we use renderers, for example a renderer based on TWIG templates.
- The root idea and implementation of Oro layouts are mostly similar to the Symfony's [Forms](http://symfony.com/doc/current/book/forms.html) component. However, the difference is that layouts support only one-way data flow. It means that content of layout widgets can be rendered based on data, but layouts cannot be used to process user-submitted data.
- There are two core layout widgets, the **block** and the **container**:

    - The block represents a widget which cannot contain any other widgets. Examples of blocks can be a label, a chart, a grid, etc.
    - The container is a structural widget which can contain other widgets. Examples of containers can be a header, a side bar, a page body, etc.

High-Level Architecture
-----------------------

[](#high-level-architecture)

[![The high-level architecture](./Resources/doc/high_level_architecture.png "The high-level architecture of Oro Layout component")](./Resources/doc/high_level_architecture.png)

The Oro Layout component includes three main layers:

- The **Foundation** layer provides the main architectural components used to build a layout.
- The **Extensions** layer extends the layout with more useful features, such as loading widgets from the DI container and working with layout inheritance.
- The **View** layer provides components responsible for translating a layout into rendering HTML, XML, or any other format.

The Oro Layout component provides several pluggable extensions out of the box:

- The **Core** extension provides all widget definitions (called block types) implemented by the component.
- The **DI** extension adds support for the Symfony's [Dependency Injection](http://symfony.com/doc/current/components/dependency_injection/introduction.html) component.
- The **Themes** extensions allows to build layouts based on other layouts and provide flexible configuration of layouts.

Layout Life Cycle
-----------------

[](#layout-life-cycle)

The layout usually goes through the stages outlined in the following table.

StageDescription**Create the layout context**The layout context should be created manually by calling the constructor of the [LayoutContext](./LayoutContext.php) class. If necessary, additional variables can be added to the context at this stage.**Configure the layout context**At this stage, the `configureContext` method of all registered [layout configurators](./ContextConfiguratorInterface.php) is called.**Resolve the layout context**After this stage, adding new variables to the layout context is not possible, but it is still possible to change the value of existing variables.**Add `root` block**The root block should be added manually to start the execution of the layout update chain. See the description of the next stage for more details.**Execute layout updates**The layout updates are linked to the layout blocks, so they are executed after a block is added to the layout. If a block is not specified for an layout update, it is linked to the root block.**Build blocks**A block hierarchy is build starting from a parent block. The `buildBlock` method of the base block type is called first, then the `buildBlock` method of all registered extensions of the base block type is called; next the `buildBlock` method of the inherited block type and its extensions are called, etc.**Build block views**A block view hierarchy is build starting from a parent block. The `buildView` method of the base block type is called first, then the `buildView` method of all registered extensions of the base block type is called; next the `buildView` method of the inherited block type and its extensions are called, etc. The `buildView` method is called before the child views are built, so it is not possible to access child views there.**Finish building of block views**First, a parent view finishes building. The `finishView` method of the base block type is called first, then the `finishView` method of all registered extensions of the base block type is called; next the `finishView` method of the inherited block type and its extensions are called, etc. The `finishView` method is called after the child views are built, but before the child views finish building.**Render the layout**the layout rendering is the same as in Symfony Forms. See [How to Customize Form Rendering](http://symfony.com/doc/current/cookbook/form/form_customization.html) for more details.The following example illustrates how a simple layout can be build.

```
$context = new LayoutContext();
$context->getResolver()
	->setRequired(['some_variable']);
$context->set('some_variable', 'some_value');

$layoutFactory = Layouts::createLayoutFactory();
$layout = $layoutFactory->createLayoutBuilder()
	->add('root', null, 'root')
	->add('header', 'root', 'header')
	->add('logo', 'header', 'logo', ['title' => 'Hello World!'])
	->getLayout($context);

echo $layout->render();
```

Also you can render only layout subtree instead of full tree. For this you should set `rootId` argument in `LayoutBuilder::getLayout`.

```
$layout = $layoutFactory->createLayoutBuilder()
	...
	->getLayout($context, 'some_block_id');
echo $layout->render();
```

To improve your understanding of how the layout works, study the [Layouts](./Layouts.php) class, the `getLayout` method of the [LayoutBuilder](./LayoutBuilder.php) class and the [BlockFactory](./BlockFactory.php) class. pay close attention to the `postExecuteAction` method of the[DeferredLayoutManipulator](./DeferredLayoutManipulator.php) class and the [LayoutRegistry](./LayoutRegistry.php) class.

Developer Reference
-------------------

[](#developer-reference)

The following is the list of the most important classes of the Oro Layout component:

- [LayoutManager](./LayoutManager.php) is the main entry point to the Oro Layout component.
- [Layouts](./Layouts.php) is the static helper that can be used if a dependency injection container is not used in your application.
- [Layout](./Layout.php) represents a layout which is ready to be rendered.
- [LayoutBuilder](./LayoutBuilder.php) provides a set of methods to build the layout.
- [LayoutRegistry](./LayoutRegistry.php) holds all layout extensions.
- [RawLayout](./RawLayout.php) represents a storage for all layout data, including a list of items, hierarchy of items, aliases, etc. This is an internal class and usually you do not need to use it outside of the component.
- [RawLayoutBuilder](./RawLayoutBuilder.php) provides a way to build the layout data storage. This is an internal class and usually you do not need to use it outside of the component.
- [DeferredLayoutManipulator](./DeferredLayoutManipulator.php) allows to construct a layout without worrying about the order of method calls.
- [BlockTypeInterface](./BlockTypeInterface.php) provides an interface for all block types.
- [AbstractType](./Block/Type/AbstractType.php) can be used as the base class for all **block** block types.
- [AbstractContainerType](./Block/Type/AbstractContainerType.php) can be used as the base class for all **container** block types.
- [BlockFactory](./BlockFactory.php) implements the logic for building layout blocks and their views.
- [DataProviderDecorator](./DataProviderDecorator.php) allows to calls methods with pre-defined prefix.
- [ThemeExtension](./Extension/Theme/ThemeExtension.php) loads layout updates.
- [ImportVisitor](./Extension/Theme/Visitor/ImportVisitor.php) loads imports.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e22c74f72bb1a7d7119d8a462389ea0ebd3c5b0b7c807aab29de3acc4b944e4?d=identicon)[orocrm](/maintainers/orocrm)

![](https://www.gravatar.com/avatar/619e0283200e93fa5a3b6d2d54151a0b838082736957cfbb72ddc6bd7746aee3?d=identicon)[sergeyz](/maintainers/sergeyz)

---

Top Contributors

[![vsoroka](https://avatars.githubusercontent.com/u/4763952?v=4)](https://github.com/vsoroka "vsoroka (169 commits)")[![vladimirseniuk](https://avatars.githubusercontent.com/u/3224886?v=4)](https://github.com/vladimirseniuk "vladimirseniuk (70 commits)")[![anyt](https://avatars.githubusercontent.com/u/5183991?v=4)](https://github.com/anyt "anyt (59 commits)")[![popadko](https://avatars.githubusercontent.com/u/1937921?v=4)](https://github.com/popadko "popadko (27 commits)")[![arbitbet](https://avatars.githubusercontent.com/u/218938?v=4)](https://github.com/arbitbet "arbitbet (14 commits)")[![sokal32](https://avatars.githubusercontent.com/u/2287143?v=4)](https://github.com/sokal32 "sokal32 (14 commits)")[![alexandr-parkhomenko](https://avatars.githubusercontent.com/u/6198444?v=4)](https://github.com/alexandr-parkhomenko "alexandr-parkhomenko (13 commits)")[![4alexandr](https://avatars.githubusercontent.com/u/2972785?v=4)](https://github.com/4alexandr "4alexandr (4 commits)")[![vitaliyberdylo](https://avatars.githubusercontent.com/u/1668719?v=4)](https://github.com/vitaliyberdylo "vitaliyberdylo (4 commits)")[![dxops](https://avatars.githubusercontent.com/u/1804871?v=4)](https://github.com/dxops "dxops (3 commits)")[![SergeyZ](https://avatars.githubusercontent.com/u/92912310?v=4)](https://github.com/SergeyZ "SergeyZ (3 commits)")[![yshyshkin](https://avatars.githubusercontent.com/u/3470882?v=4)](https://github.com/yshyshkin "yshyshkin (2 commits)")[![aalgogiver](https://avatars.githubusercontent.com/u/11629050?v=4)](https://github.com/aalgogiver "aalgogiver (2 commits)")[![br0ther](https://avatars.githubusercontent.com/u/5927797?v=4)](https://github.com/br0ther "br0ther (2 commits)")[![ReenExe](https://avatars.githubusercontent.com/u/10358615?v=4)](https://github.com/ReenExe "ReenExe (1 commits)")[![sprightly](https://avatars.githubusercontent.com/u/8336903?v=4)](https://github.com/sprightly "sprightly (1 commits)")[![kisakova](https://avatars.githubusercontent.com/u/22588947?v=4)](https://github.com/kisakova "kisakova (1 commits)")[![gplanchat](https://avatars.githubusercontent.com/u/152367?v=4)](https://github.com/gplanchat "gplanchat (1 commits)")[![getron-pl](https://avatars.githubusercontent.com/u/15019354?v=4)](https://github.com/getron-pl "getron-pl (1 commits)")[![x86demon](https://avatars.githubusercontent.com/u/196506?v=4)](https://github.com/x86demon "x86demon (1 commits)")

### Embed Badge

![Health badge](/badges/oro-layout/health.svg)

```
[![Health](https://phpackages.com/badges/oro-layout/health.svg)](https://phpackages.com/packages/oro-layout)
```

###  Alternatives

[inc2734/wp-github-theme-updater

A library for WordPress that automatic theme updater with GitHub API.

119.6k1](/packages/inc2734-wp-github-theme-updater)[maximaster/tools.finder

Библиотека, облегчающая поиск идентификаторов разных сущностей для 1С-Битрикс

107.7k](/packages/maximaster-toolsfinder)[uspdev/laravel-usp-theme

usp theme for laravel

116.0k](/packages/uspdev-laravel-usp-theme)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
