Hi @borkacer ,
So I’ll describe below how I would create this module. I’ll leave out any advanced options or styling, but this should get you going.
Step 1
Create a module in the ‘Design Tools’ (Marketing > Files and templates > Design tools) by clicking on the ‘File’ dropdown on the left side of the screen.
Select ‘Module’ in the popup that shows when you click ‘New file’.
Step 2
Decide what templates you want to use your module in, and give it a recognizable name. You can set it as a ‘global’ module if you want the content to be the same for all pages. If not, select ‘local’ module.
Step 3
Determine the fields you need for this module. Based on your screenshot, I think we need the following:
- Image (for the background, we will set this in the ‘Style Fields’ below the default ‘Fields’)
- Form (for the form, duh)
- Rich text (for the content)
- Choice (for the position of the content (optional)) (Options: left / right)
On the right side of the screen, click on the ‘Add field’ button and select the field types you need. Give them a recognizable name, so you can use that in the code.
You should now have the following fields:
Step 4
Write the necessary HTML for this module. Below is a code snippet that gives you same basic HTML which should help you to create your module:
{% require_css %}
<style>
{% scope_css %}
.form-with-content {
{{ module.style.background.css }}
}
{% end_scope_css %}
</style>
{% end_require_css %}
<section class="form-with-content">
<div class="form-with-content__container">
<div class="form-with-content__content form-with-content__content--{{module.position}}">
{{ module.content }} <!-- this will contain the content set through your 'Content' field -->
</div>
<div class="form-with-content__form">
<!-- Below is the necessary HuBL for the form to show -->
{% form
form_to_use="{{ module.form.form_id }}"
response_response_type="{{ module.form.response_type }}"
response_message="{{ module.form.message }}"
response_redirect_id="{{ module.form.redirect_id }}"
response_redirect_url="{{module.form.redirect_url}}"
%}
</div>
</div>
</section>
Step 5
Write the necessary CSS for the module. I used the Style fields to generate some basic inline styling for the background image. If you want to style the background image yourself, please let me know. Below is some basic styling:
.form-with-content {
padding: 3rem 0; /* Change this if needed */
}
.form-with-content__container {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
max-width: 1200px; /* Change this */
margin: 0 auto;
}
.form-with-content__content,
.form-with-content__form {
display: block;
box-sizing: border-box;
width: 50%;
}
.form-with-content__content {
padding-right: 3rem; /* Change this */
/* Add some more styling for the typography if needed */
}
.form-with-content__content--right {
order: 2; /* Styling based on the 'position' field */
padding-right: 0;
padding-left: 3rem; /* Change this if needed */
}
/* styling for mobile, change the pixels if needed */
@media screen and max-width(767px) {
.form-with-content__content,
.form-with-content__form {
width: 100%;
}
.form-with-content__content {
padding-right: 0;
padding-left: 0;
padding-bottom: 2rem; /* Change this if needed */
}
.form-with-content__content--right {
padding-bottom: 0;
padding-top: 2rem; /* Assuming the content is at the bottom on mobile devices */
}
}
Ofcourse this needs some more work, but this should get you going.