Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EWPP-4454: Add Simple banner variant. #1476

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
langcode: en
status: true
dependencies:
config:
- core.entity_form_mode.paragraph.oe_banner_simple
- field.field.paragraph.oe_banner.field_oe_banner_alignment
- field.field.paragraph.oe_banner.field_oe_banner_full_width
- field.field.paragraph.oe_banner.field_oe_banner_size
- field.field.paragraph.oe_banner.field_oe_banner_type
- field.field.paragraph.oe_banner.field_oe_link
- field.field.paragraph.oe_banner.field_oe_media
- field.field.paragraph.oe_banner.field_oe_text
- field.field.paragraph.oe_banner.field_oe_title
- paragraphs.paragraphs_type.oe_banner
module:
- link
id: paragraph.oe_banner.oe_banner_simple
targetEntityType: paragraph
bundle: oe_banner
mode: oe_banner_simple
content:
field_oe_banner_alignment:
type: options_select
weight: 3
region: content
settings: { }
third_party_settings: { }
field_oe_banner_full_width:
type: boolean_checkbox
weight: 0
region: content
settings:
display_label: true
third_party_settings: { }
field_oe_banner_size:
type: options_select
weight: 2
region: content
settings: { }
third_party_settings: { }
field_oe_link:
type: link_default
weight: 5
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_media:
type: entity_reference_autocomplete
weight: 6
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
field_oe_text:
type: string_textfield
weight: 4
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
translation:
weight: 7
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
field_oe_banner_type: true
status: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
langcode: en
status: true
dependencies:
module:
- paragraphs
id: paragraph.oe_banner_simple
label: 'Simple banner'
description: ''
targetEntityType: paragraph
cache: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
langcode: en
status: true
dependencies:
config:
- core.entity_form_mode.paragraph.oe_banner_simple
- field.field.paragraph.oe_banner.field_oe_banner_alignment
- field.field.paragraph.oe_banner.field_oe_banner_full_width
- field.field.paragraph.oe_banner.field_oe_banner_size
- field.field.paragraph.oe_banner.field_oe_banner_type
- field.field.paragraph.oe_banner.field_oe_link
- field.field.paragraph.oe_banner.field_oe_media
- field.field.paragraph.oe_banner.field_oe_text
- field.field.paragraph.oe_banner.field_oe_title
- paragraphs.paragraphs_type.oe_banner
module:
- link
id: paragraph.oe_banner.oe_banner_simple
targetEntityType: paragraph
bundle: oe_banner
mode: oe_banner_simple
content:
field_oe_banner_alignment:
type: options_select
weight: 3
region: content
settings: { }
third_party_settings: { }
field_oe_banner_full_width:
type: boolean_checkbox
weight: 0
region: content
settings:
display_label: true
third_party_settings: { }
field_oe_banner_size:
type: options_select
weight: 2
region: content
settings: { }
third_party_settings: { }
field_oe_link:
type: link_default
weight: 5
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_media:
type: entity_reference_autocomplete
weight: 6
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
field_oe_text:
type: string_textfield
weight: 4
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
translation:
weight: 7
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
field_oe_banner_type: true
status: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
langcode: en
status: true
dependencies:
module:
- paragraphs
id: paragraph.oe_banner_simple
label: 'Simple banner'
description: ''
targetEntityType: paragraph
cache: true

Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function oe_theme_paragraphs_banner_install($is_syncing) {
return;
}
$form_modes_labels = [
'paragraph.oe_banner_primary' => 'Plain background banner',
'paragraph.oe_banner_image' => 'Text box banner',
'paragraph.oe_banner_image_shade' => 'Image overlay banner',
'paragraph.oe_banner_primary' => 'Plain background',
'paragraph.oe_banner_image' => 'Text box',
'paragraph.oe_banner_image_shade' => 'Text overlay',
];
foreach ($form_modes_labels as $id => $label) {
$form_mode = EntityFormMode::load($id);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* @file
* The OE Theme Paragraphs Banner post updates.
*/

declare(strict_types=1);

use Drupal\Component\Utility\Crypt;
use Drupal\Core\Config\FileStorage;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityFormMode;

/**
* Update Banner paragraph form displays.
*/
function oe_theme_paragraphs_banner_post_update_00001(): void {
// Update the oe_banner_image_shade form mode's label.
$form_mode = EntityFormMode::load('paragraph.oe_banner_image_shade');
$form_mode->set('label', 'Text overlay');
$form_mode->save();

// Create the simple banner form mode and form display.
$file_storage = new FileStorage(\Drupal::service('extension.list.module')->getPath('oe_theme_paragraphs_banner') . '/config/post_updates/00001_simple_banner');
$simple_banner = EntityFormMode::load('paragraph.oe_banner_simple');
if (!$simple_banner) {
$form_mode_values = $file_storage->read('core.entity_form_mode.paragraph.oe_banner_simple');
$form_mode_values['_core']['default_config_hash'] = Crypt::hashBase64(serialize($form_mode_values));
EntityFormMode::create($form_mode_values)->save();
}
$simple_banner = EntityFormDisplay::load('paragraph.oe_banner.oe_banner_simple');
if (!$simple_banner) {
$form_display_values = $file_storage->read('core.entity_form_display.paragraph.oe_banner.oe_banner_simple');
$form_display_values['_core']['default_config_hash'] = Crypt::hashBase64(serialize($form_display_values));
EntityFormDisplay::create($form_display_values)->save();
}
}