diff --git a/src/FieldTypes/CustomHtmlBlockType.php b/src/FieldTypes/CustomHtmlBlockType.php new file mode 100644 index 0000000..f283d3f --- /dev/null +++ b/src/FieldTypes/CustomHtmlBlockType.php @@ -0,0 +1,30 @@ +setDefaults([ + 'html' => null, + 'view' => null + ]); + } + + public function buildView(FormView $view, FormInterface $form, array $options) + { + $view->vars['html'] = $options['html']; + + // Load in template as Twig\Markup object. + if (!empty($options['view'])) { + $view->vars['html'] = new Markup($options['view'], 'UTF-8'); + } + } +} diff --git a/src/Resources/views/Form/accessible-forms.html.twig b/src/Resources/views/Form/accessible-forms.html.twig index 340836e..2aba1e1 100644 --- a/src/Resources/views/Form/accessible-forms.html.twig +++ b/src/Resources/views/Form/accessible-forms.html.twig @@ -217,3 +217,9 @@ {{ block('attributes') }} {%- endblock widget_attributes -%} +{# Custom HTML block #} +{%- block custom_html_block_row -%} + {%- if html is not empty -%}{{ html }}{%- endif -%} +{%- endblock -%} + +