All I want to do is add a new <div>
, ideally just after a <form>
element. I have a self-written module that generates a payment form, using some routing, like this:
mymodule.applications.payment_form:
path: '/payment/{submission}'
defaults:
_form: '\Drupal\mymodule\Form\PaymentForm'
_title_callback: '\Drupal\mymodule\Form\PaymentForm::getTitle'
requirements:
_role: 'authenticated'
_custom_access: 'Drupal\mymodule\Form\PaymentForm::access'
options:
parameters:
submission:
type: entity:webform_submission
The PaymentForm class has a standard buildForm() method, and it's easy to add render arrays to the $form build form elements and other decoration etc. But those are all within the <form>
tag.
The payment form is displayed in the main page content block.
I've been trying is HOOK_preprocess_HTML in my mymodule.module
file and looking at $vars.
$vars['page'] contains the various regions: sidebar_first, content, secondary_menu etc.
$vars['page']['content'] consists of:
'mysite_page_title' => array(13)
'mysite_local_tasks' => array(3)
'mysite_help' => array(3)
'mysite_local_actions' => array(3)
'mysite_content' => array(12)
'#sorted' => boolTRUE
'#theme_wrappers' => array(1)
'#region' => string(7) "content"
mysite_content
is a block - and I can't see how I can modify it from here...
I've also tried HOOK_block_view_BASE_BLOCK_ID_alter, which in this case is system_main_block (for the page content).
function mymodule_block_view_system_main_block_alter gives me a $build array with a #block element, but I don't see how I can find the <form>
elements in there either and place something afterwards…
Anything else I can do?