diff --git a/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml b/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml new file mode 100644 index 000000000..42b66c04c --- /dev/null +++ b/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml @@ -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 + diff --git a/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_mode.paragraph.oe_banner_simple.yml b/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_mode.paragraph.oe_banner_simple.yml new file mode 100644 index 000000000..882ab0b0d --- /dev/null +++ b/modules/oe_theme_paragraphs_banner/config/install/core.entity_form_mode.paragraph.oe_banner_simple.yml @@ -0,0 +1,11 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.oe_banner_simple +label: 'Simple banner' +description: '' +targetEntityType: paragraph +cache: true + diff --git a/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml b/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml new file mode 100644 index 000000000..42b66c04c --- /dev/null +++ b/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_display.paragraph.oe_banner.oe_banner_simple.yml @@ -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 + diff --git a/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_mode.paragraph.oe_banner_simple.yml b/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_mode.paragraph.oe_banner_simple.yml new file mode 100644 index 000000000..882ab0b0d --- /dev/null +++ b/modules/oe_theme_paragraphs_banner/config/post_updates/00001_simple_banner/core.entity_form_mode.paragraph.oe_banner_simple.yml @@ -0,0 +1,11 @@ +langcode: en +status: true +dependencies: + module: + - paragraphs +id: paragraph.oe_banner_simple +label: 'Simple banner' +description: '' +targetEntityType: paragraph +cache: true + diff --git a/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.install b/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.install index bfc188737..4526f3adb 100644 --- a/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.install +++ b/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.install @@ -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); diff --git a/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.post_update.php b/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.post_update.php new file mode 100644 index 000000000..e1a81c6e6 --- /dev/null +++ b/modules/oe_theme_paragraphs_banner/oe_theme_paragraphs_banner.post_update.php @@ -0,0 +1,38 @@ +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(); + } +}