Implementing a simple brick
In this section, we will implement our first brick. Because the spirit of this book is to learn using real-world examples, we won't limit this to a "hello world" example. In our first example, we will create a widget that could be placed many times on the page and reused. This widget will allow adding text, choosing the header type (h1, h2, and so on), and entering the text.
To complete this goal, we have to follow these steps:
- Create a document and link it to a controller and a template file. We have done this step many times in Chapter 4, Creating Documents in Pimcore, and Chapter 9, Configuring Entities and Rendering Data. This document will be used for testing the brick that we are creating.
- Create a
Heading.php
file inside/bundles/BlogBundle/Document/Areabrick
. The contents of the file should be like this:class Header extends AbstractTemplateAreabrick { public function getName() ...