-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EWPP-4454: Add Simple banner variant.
- Loading branch information
1 parent
259ad0d
commit 2972b99
Showing
6 changed files
with
231 additions
and
3 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
...s_banner/config/install/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
11 changes: 11 additions & 0 deletions
11
...eme_paragraphs_banner/config/install/core.entity_form_mode.paragraph.oe_banner_simple.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
84 changes: 84 additions & 0 deletions
84
...tes/00001_simple_banner/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
11 changes: 11 additions & 0 deletions
11
...fig/post_updates/00001_simple_banner/core.entity_form_mode.paragraph.oe_banner_simple.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.post_update.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |