Implementing a contact form brick
In this example, we will discover how to create an interactive component where the user can insert data. For this purpose, we will create a contact form. The behavior of this widget will be straightforward: we will have a form with a subject, name, message, and clickable button. An email will be sent to a fixed recipient address once the details are filled in and the button is clicked. This example will also introduce a working example of opening the brick's editor to get parameters not shown in the view. Follow these steps to implement the example:
- First, create a document with a template and place an
areabrick
in the editable's template. In the next step, we will have to create the brick. - Create the
ContactForm.php
file in/bundles/BlogBundle/Document/Areabrick/
. The content will be as follows:class ContactForm extends AbstractTemplateAreabrick { public function getName() { &...