Skip to content

Commit

Permalink
Merge branch 'newsletter-date' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbutura committed Jun 19, 2024
2 parents 4eb3ed5 + 0a53b90 commit 0b36a0d
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- field.field.block_content.newsletter.body
- field.field.block_content.newsletter.field_link_text
- field.field.block_content.newsletter.field_paragraphs
- field.field.block_content.newsletter.field_show_season
module:
- paragraphs
id: block_content.newsletter.default
Expand Down Expand Up @@ -42,13 +41,6 @@ content:
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_show_season:
type: boolean_checkbox
weight: 1
region: content
settings:
display_label: true
third_party_settings: { }
info:
type: string_textfield
weight: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- field.field.paragraph.newsletter.field_date
- field.field.paragraph.newsletter.field_link_one
- field.field.paragraph.newsletter.field_name
- field.field.paragraph.newsletter.field_svg
- paragraphs.paragraphs_type.newsletter
module:
Expand Down Expand Up @@ -33,6 +34,14 @@ content:
link_class_force: 'btn btn-clear btn-arrow btn-arrow-link stretched-link'
link_class_select: ''
third_party_settings: { }
field_name:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_svg:
type: media_library_widget
weight: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- field.field.block_content.newsletter.body
- field.field.block_content.newsletter.field_link_text
- field.field.block_content.newsletter.field_paragraphs
- field.field.block_content.newsletter.field_show_season
module:
- entity_reference_revisions
id: block_content.newsletter.default
Expand All @@ -27,5 +26,4 @@ content:
hidden:
body: true
field_link_text: true
field_show_season: true
search_api_excerpt: true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
config:
- field.field.paragraph.newsletter.field_date
- field.field.paragraph.newsletter.field_link_one
- field.field.paragraph.newsletter.field_name
- field.field.paragraph.newsletter.field_svg
- image.style.newsletter
- paragraphs.paragraphs_type.newsletter
Expand Down Expand Up @@ -38,6 +39,14 @@ content:
third_party_settings: { }
weight: 1
region: content
field_name:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 0
region: content
field_svg:
type: media_thumbnail
label: hidden
Expand Down

This file was deleted.

19 changes: 19 additions & 0 deletions config/sync/field.field.paragraph.newsletter.field_name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
uuid: 35ed673b-5dae-47ef-ad4c-eecdc1b1f788
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.field_name
- paragraphs.paragraphs_type.newsletter
id: paragraph.newsletter.field_name
field_name: field_name
entity_type: paragraph
bundle: newsletter
label: 'Edition name'
description: 'Leave empty to show the date instead.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string
18 changes: 0 additions & 18 deletions config/sync/field.storage.block_content.field_show_season.yml

This file was deleted.

2 changes: 1 addition & 1 deletion config/sync/tour.tour.honeypot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ tips:
weight: -7
position: top-start
selector: '#edit-element-name'
body: "Spam bots typically fill out any field they believe will help get links back to their site, so tempting them with a field named something like 'url', 'homepage', or 'link' makes it hard for them to resist filling in the field—and easy to catch them in the trap and reject their submissions!"
body: "Spam bots typically fill out any field they believe will help get links back to their site, so tempting them with a field named something like 'url', 'homepage', or 'link' makes it hard for them to resist filling in the fieldand easy to catch them in the trap and reject their submissions!"
honeypot-time-limit:
id: honeypot-time-limit
plugin: text
Expand Down
2 changes: 1 addition & 1 deletion config/sync/webform.webform.survey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ settings:
form_open_message: ''
form_close_message: ''
form_exception_message: ''
form_previous_submissions: true
form_previous_submissions: false
form_confidential: false
form_confidential_message: ''
form_disable_remote_addr: false
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions web/themes/custom/parc/parc.theme
Original file line number Diff line number Diff line change
Expand Up @@ -438,46 +438,6 @@ function parc_preprocess_node__search_teaser(&$variables) {
}
}

/**
* Implements hook_preprocess_HOOK() for paragraph__newsletter.
*/
function parc_preprocess_paragraph__newsletter(&$variables) {
/** @var \Drupal\paragraphs\ParagraphInterface $paragraph */
$paragraph = $variables['paragraph'];
$date = $paragraph->get('field_date')->value;

$block = $paragraph->getParentEntity();
if ($block instanceof BlockContent
&& $block->hasField('field_show_season')
&& $block->get('field_show_season')->value) {
$year = date('Y', strtotime($date));
$spring = "$year-03-01";
$summer = "$year-06-01";
$autumn = "$year-09-01";
$winter = "$year-12-01";

switch (TRUE) {
case $date >= $spring && $date < $summer:
$variables['season'] = t('Spring');
break;

case $date >= $summer && $date < $autumn:
$variables['season'] = t('Summer');
break;

case $date >= $autumn && $date < $winter:
$variables['season'] = t('Autumn');
break;

default:
$variables['season'] = t('Winter');
}

$variables['newsletter_date'] = $variables['season'] . ' ' . date('Y', strtotime($date));
$variables['show_season'] = TRUE;
}
}

/**
* Implements hook_preprocess_HOOK() for menu__sidebar_dropdown.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
<div{{attributes.addClass(classes)}}>
<div class="wrap">
<div class="d-flex justify-content-end">
{% if show_season %}
{% if paragraph.field_name.value %}
<div class="field field--name-field-date text-uppercase mb-2">
{{ newsletter_date }}
{{ content.field_name }}
</div>
{% else %}
{{ content.field_date }}
{% endif %}
</div>
{{ content.field_svg }}
</div>
{{ content|without('field_svg', 'field_date') }}
{{ content|without('field_svg', 'field_date', 'field_name') }}
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.paragraph--count {
font-size: 16px;
font-size: 12px;
font-weight: 400;
position: absolute;
top: 6px;
Expand All @@ -15,7 +15,7 @@

.field--name-field-date {
color: var(--lichtblauw);
font-size: 16px;
font-size: 12px;
font-weight: 400;
}

Expand Down

0 comments on commit 0b36a0d

Please sign in to comment.