Add the subscription form below the body content
Add the subscription form below the body content for daily email nodes.
This commit is contained in:
parent
a0f25bb985
commit
6b15e5c40a
3 changed files with 61 additions and 1 deletions
|
@ -7,8 +7,55 @@ dependencies:
|
||||||
- field.field.node.daily_email.field_daily_email_cta
|
- field.field.node.daily_email.field_daily_email_cta
|
||||||
- node.type.daily_email
|
- node.type.daily_email
|
||||||
module:
|
module:
|
||||||
|
- layout_builder
|
||||||
|
- layout_discovery
|
||||||
|
- opd_daily_emails
|
||||||
- text
|
- text
|
||||||
- user
|
- user
|
||||||
|
third_party_settings:
|
||||||
|
layout_builder:
|
||||||
|
enabled: true
|
||||||
|
allow_custom: false
|
||||||
|
sections:
|
||||||
|
-
|
||||||
|
layout_id: layout_onecol
|
||||||
|
layout_settings:
|
||||||
|
label: ''
|
||||||
|
components:
|
||||||
|
5f64dbd7-4d0e-4ac0-ae42-a1698b66931a:
|
||||||
|
uuid: 5f64dbd7-4d0e-4ac0-ae42-a1698b66931a
|
||||||
|
region: content
|
||||||
|
configuration:
|
||||||
|
id: 'field_block:node:daily_email:body'
|
||||||
|
label_display: '0'
|
||||||
|
context_mapping:
|
||||||
|
entity: layout_builder.entity
|
||||||
|
formatter:
|
||||||
|
type: text_default
|
||||||
|
label: hidden
|
||||||
|
settings: { }
|
||||||
|
third_party_settings: { }
|
||||||
|
weight: 0
|
||||||
|
additional: { }
|
||||||
|
third_party_settings: { }
|
||||||
|
-
|
||||||
|
layout_id: layout_onecol
|
||||||
|
layout_settings:
|
||||||
|
label: ''
|
||||||
|
context_mapping: { }
|
||||||
|
components:
|
||||||
|
fe7184b1-4b65-4fc2-bb42-3bdbb81287c7:
|
||||||
|
uuid: fe7184b1-4b65-4fc2-bb42-3bdbb81287c7
|
||||||
|
region: content
|
||||||
|
configuration:
|
||||||
|
id: opd_daily_emails_kit_subscription_block
|
||||||
|
label: 'Was this interesting?'
|
||||||
|
label_display: visible
|
||||||
|
provider: opd_daily_emails
|
||||||
|
context_mapping: { }
|
||||||
|
weight: 0
|
||||||
|
additional: { }
|
||||||
|
third_party_settings: { }
|
||||||
id: node.daily_email.default
|
id: node.daily_email.default
|
||||||
targetEntityType: node
|
targetEntityType: node
|
||||||
bundle: daily_email
|
bundle: daily_email
|
||||||
|
|
|
@ -20,6 +20,19 @@ final class KitSubscriptionForm extends FormBase {
|
||||||
* @return array<non-empty-string, mixed>
|
* @return array<non-empty-string, mixed>
|
||||||
*/
|
*/
|
||||||
public function buildForm(array $form, FormStateInterface $formState): array {
|
public function buildForm(array $form, FormStateInterface $formState): array {
|
||||||
|
// TODO: refactor to a custom theme function.
|
||||||
|
// TODO: make this optional. I may not want the intro text on every form - especially when two are on the same page.
|
||||||
|
$form['intro'] = [
|
||||||
|
'#type' => 'html_tag',
|
||||||
|
'#tag' => 'div',
|
||||||
|
'#attributes' => [
|
||||||
|
'class' => 'prose prose-p:text-black prose-a:font-light prose-a:text-blue-primary prose-p:text-lg prose-blockquote:border-blue-primary dark:marker:text-white prose-li:my-1 prose-li:text-lg prose-figcaption:text-white prose-li:text-black marker:text-black dark:prose-p:text-white dark:prose-invert dark:prose-a:text-blue-400 dark:prose-blockquote:border-blue-400 dark:prose-li:text-white prose-a:hover:no-underline prose-h2:text-xl prose-code:font-normal prose-h2:mb-4 prose-ul:my-3 dark:prose-hr:border-neutral-400 prose-code:before:content-[\'\'] prose-code:after:content-[\'\'] prose-pre:bg-neutral-200 prose-pre:text-black prose-pre:rounded-none prose-code:bg-neutral-200',
|
||||||
|
'style' => 'margin-bottom: 1rem;',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$form['intro']['text']['#markup'] = '<p>' . t('Subscribe to my daily newsletter for software professionals on software development and delivery, Drupal, DevOps, community, and open-source.') . '</p>';
|
||||||
|
|
||||||
$form['email_address'] = [
|
$form['email_address'] = [
|
||||||
'#placeholder' => 'me@example.com',
|
'#placeholder' => 'me@example.com',
|
||||||
'#title' => $this->t('What is your best email address?'),
|
'#title' => $this->t('What is your best email address?'),
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div{{ content_attributes }}>
|
<div{{ content_attributes.addClass('space-y-8') }}>
|
||||||
{{ content }}
|
{{ content }}
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue