Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Unverified Commit 7b8b9c67 authored by Andreas Hennings's avatar Andreas Hennings Committed by GitHub
Browse files

Merge pull request #105 from openeuropa/EPIC-OEL-1255-migrate-paragraphs

EPIC: OEL-1255: Migrate paragraphs
parents cdc9292c d9ba3355
No related branches found
No related tags found
3 merge requests!121OEL-1421: Fix cosmetic changes.,!116OEL-1394: Merge 1.x into EPIC-1293-Project, align with new version of card:search pattern,!115Upate the EPIC-1293-project
Showing
with 694 additions and 2 deletions
# The OpenEuropa Whitelabel theme
## Paragraphs
The paragraphs below are not yet themed therefore not recommended for usage:
- Contextual navigation
- Document
Some paragraphs are considered "internal", and only meant to be used inside other paragraphs:
- Listing item: To be used as item paragraph within 'Listing item block'.
- Fact: To be used as item paragraph within 'Facts and figures'.
## Requirements
This depends on the following software:
......@@ -18,7 +30,13 @@ composer require openeuropa/oe_whitelabel
In order to enable the theme in your project perform the following steps:
- Enable the OpenEuropa Whitelabel Theme and set it as default ```./vendor/bin/drush config-set system.theme default oe_bootstrap_theme```
- Enable the OpenEuropa Whitelabel Theme and set it as default ```./vendor/bin/drush config-set system.theme default oe_whitelabel_theme```
### Integration with oe_paragraphs
In order to have full working integration with paragraphs in your project, you must enable oe_whitelabel_paragraphs module:
```./vendor/bin/drush en oe_whitelabel_paragraphs```
## Development setup
......@@ -129,3 +147,25 @@ To run the phpunit tests:
```bash
docker-compose exec web ./vendor/bin/phpunit
```
## Upgrade from older versions
### Upgrade to 1.0.0-alpha6
#### Paragraphs migration
Paragraphs-related theming and functionality has been moved from the [OpenEuropa Bootstrap base theme](https://github.com/openeuropa/oe_bootstrap_theme) to [OpenEuropa Whitelabel](https://github.com/openeuropa/oe_whitelabel).
Special paragraphs fields that were introduced in `oe_bootstrap_theme_paragraphs` are being renamed in `oe_whitelabel_paragraphs`.
If you have the `oe_paragraphs` module enabled, you should create a `hook_post_update_NAME()` in your code, to enable the `oe_whitelabel_paragraphs` module during deployment.
```php
function EXAMPLE_post_update_00001(): void {
\Drupal::service('module_installer')->install(['oe_whitelabel_paragraphs']);
}
```
This is needed to make sure that the install hook for `oe_whitelabel_paragraphs` runs _before_ config-import during a deployment.
Note that `drush updb` will also trigger update hooks in `oe_bootstrap_theme_helper`, which will uninstall the legacy module `oe_bootstrap_theme_paragraphs`.
......@@ -19,8 +19,9 @@
"drupal/core-composer-scaffold": "^9.2",
"drupal/core-dev": "^9.2",
"drupal/ctools": "^3.7",
"drupal/description_list_field": "^1.0@alpha",
"drupal/drupal-extension": "~4.1",
"drupal/file_link": "^2.0.4",
"drupal/file_link": "^2.0.6",
"drupal/pathauto": "^1.8",
"drupal/search_api": "^1.21",
"drupal/search_api_autocomplete": "^1.5",
......@@ -36,7 +37,9 @@
"openeuropa/oe_contact_forms": "~1.1",
"openeuropa/oe_content": "^2.8.0",
"openeuropa/oe_corporate_blocks": "^4.4",
"openeuropa/oe_media": "^1.14",
"openeuropa/oe_multilingual": "^1.9",
"openeuropa/oe_paragraphs": "^1.12",
"openeuropa/oe_starter_content": "1.x-dev",
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta5",
"phpspec/prophecy-phpunit": "^1 || ^2",
......@@ -67,6 +70,11 @@
}
}
},
"patches": {
"openeuropa/oe_bootstrap_theme" : {
"1.x latest": "https://github.com/openeuropa/oe_bootstrap_theme/compare/0.1.202203290731..1.x.diff"
}
},
"drupal-scaffold": {
"locations": {
"web-root": "./build"
......
<?php
/**
* @file
* Theme functions for paragraphs.
*/
declare(strict_types = 1);
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function oe_whitelabel_theme_suggestions_paragraph_alter(array &$suggestions, array $variables): void {
/** @var \Drupal\paragraphs\ParagraphInterface $paragraph */
$paragraph = $variables['elements']['#paragraph'];
if ($paragraph->bundle() === 'oe_content_row') {
$variant = $paragraph->get('oe_paragraphs_variant')->first()->value;
$suggestions[] = 'paragraph__' . $paragraph->bundle() . '__variant_' . $variant;
}
}
<?php
/**
* @file
* Install and update functions for the OE Whitelabel Helper module.
*/
declare(strict_types = 1);
/**
* Implements hook_requirements().
*/
function oe_whitelabel_helper_requirements($phase): array {
$requirements = [];
if (\Drupal::moduleHandler()->moduleExists('oe_paragraphs') && !\Drupal::moduleHandler()->moduleExists('oe_whitelabel_paragraphs')) {
$requirements['oe_whitelabel_paragraphs'] = [
'title' => 'OpenEuropa Whitelabel Paragraphs',
'description' => t('OpenEuropa Whitelabel Paragraphs is required if OpenEuropa Paragraphs is enabled.'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.oe_w_orientation
- paragraphs.paragraphs_type.oe_description_list
module:
- options
id: paragraph.oe_description_list.oe_w_orientation
field_name: oe_w_orientation
entity_type: paragraph
bundle: oe_description_list
label: Orientation
description: 'Sets the orientation (vertical|horizontal) for the paragraph.'
required: true
translatable: false
default_value:
-
value: horizontal
default_value_callback: ''
settings: { }
field_type: list_string
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.oe_w_n_columns
- paragraphs.paragraphs_type.oe_facts_figures
id: paragraph.oe_facts_figures.oe_w_n_columns
field_name: oe_w_n_columns
entity_type: paragraph
bundle: oe_facts_figures
label: 'Number of columns'
description: 'Sets the number of grid columns. Minimum number is 1 column and maximum is 3.'
required: false
translatable: false
default_value:
-
value: 1
default_value_callback: ''
settings:
min: 1
max: 3
prefix: ''
suffix: ''
field_type: integer
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.oe_w_links_block_background
- paragraphs.paragraphs_type.oe_links_block
module:
- options
id: paragraph.oe_links_block.oe_w_links_block_background
field_name: oe_w_links_block_background
entity_type: paragraph
bundle: oe_links_block
label: Background
description: 'Allows to select the background color of the links block.'
required: false
translatable: false
default_value:
-
value: gray
default_value_callback: ''
settings: { }
field_type: list_string
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.oe_w_links_block_orientation
- paragraphs.paragraphs_type.oe_links_block
module:
- options
id: paragraph.oe_links_block.oe_w_links_block_orientation
field_name: oe_w_links_block_orientation
entity_type: paragraph
bundle: oe_links_block
label: Orientation
description: 'Allows to select the direction of the links block.'
required: false
translatable: false
default_value:
-
value: vertical
default_value_callback: ''
settings: { }
field_type: list_string
langcode: en
status: true
dependencies:
config:
- field.storage.paragraph.oe_w_links_block_background
- paragraphs.paragraphs_type.oe_social_media_follow
module:
- options
id: paragraph.oe_social_media_follow.oe_w_links_block_background
field_name: oe_w_links_block_background
entity_type: paragraph
bundle: oe_social_media_follow
label: Background
description: 'Allows to select the background color of the Social Media Links block.'
required: false
translatable: false
default_value:
-
value: gray
default_value_callback: ''
settings: { }
field_type: list_string
langcode: en
status: true
dependencies:
module:
- options
- paragraphs
id: paragraph.oe_w_links_block_background
field_name: oe_w_links_block_background
entity_type: paragraph
type: list_string
settings:
allowed_values:
-
value: gray
label: Gray
-
value: transparent
label: Transparent
allowed_values_function: ''
module: options
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies:
module:
- options
- paragraphs
id: paragraph.oe_w_links_block_orientation
field_name: oe_w_links_block_orientation
entity_type: paragraph
type: list_string
settings:
allowed_values:
-
value: horizontal
label: Horizontal
-
value: vertical
label: Vertical
allowed_values_function: ''
module: options
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies:
module:
- paragraphs
id: paragraph.oe_w_n_columns
field_name: oe_w_n_columns
entity_type: paragraph
type: integer
settings:
unsigned: false
size: normal
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies:
module:
- options
- paragraphs
id: paragraph.oe_w_orientation
field_name: oe_w_orientation
entity_type: paragraph
type: list_string
settings:
allowed_values:
-
value: vertical
label: Vertical
-
value: horizontal
label: Horizontal
allowed_values_function: ''
module: options
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_accordion_item.field_oe_icon
- field.field.paragraph.oe_accordion_item.field_oe_text
- field.field.paragraph.oe_accordion_item.field_oe_text_long
- paragraphs.paragraphs_type.oe_accordion_item
module:
- text
id: paragraph.oe_accordion_item.default
targetEntityType: paragraph
bundle: oe_accordion_item
mode: default
content:
field_oe_text:
weight: 0
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_oe_text_long:
weight: 1
settings:
rows: 5
placeholder: ''
third_party_settings: { }
type: text_textarea
region: content
hidden:
created: true
field_oe_icon: true
status: true
uid: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_description_list.field_oe_description_list_items
- field.field.paragraph.oe_description_list.field_oe_title
- field.field.paragraph.oe_description_list.oe_w_orientation
- paragraphs.paragraphs_type.oe_description_list
module:
- description_list_field
id: paragraph.oe_description_list.default
targetEntityType: paragraph
bundle: oe_description_list
mode: default
content:
field_oe_description_list_items:
weight: 2
settings: { }
third_party_settings: { }
type: description_list_widget
region: content
field_oe_title:
weight: 1
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
oe_w_orientation:
type: options_select
weight: 0
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
status: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_facts_figures.field_oe_link
- field.field.paragraph.oe_facts_figures.field_oe_paragraphs
- field.field.paragraph.oe_facts_figures.field_oe_title
- field.field.paragraph.oe_facts_figures.oe_w_n_columns
- paragraphs.paragraphs_type.oe_facts_figures
module:
- link
- oe_paragraphs
id: paragraph.oe_facts_figures.default
targetEntityType: paragraph
bundle: oe_facts_figures
mode: default
content:
field_oe_link:
type: link_default
weight: 2
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_paragraphs:
type: oe_paragraphs_variants
weight: 8
region: content
settings:
title: Paragraph
title_plural: Paragraphs
edit_mode: open
add_mode: dropdown
form_display_mode: default
default_paragraph_type: ''
closed_mode: summary
autocollapse: none
closed_mode_threshold: 0
features:
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
oe_w_n_columns:
weight: 6
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
hidden:
created: true
status: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_links_block.field_oe_links
- field.field.paragraph.oe_links_block.oe_w_links_block_background
- field.field.paragraph.oe_links_block.oe_w_links_block_orientation
- field.field.paragraph.oe_links_block.field_oe_text
- paragraphs.paragraphs_type.oe_links_block
module:
- link
id: paragraph.oe_links_block.default
targetEntityType: paragraph
bundle: oe_links_block
mode: default
content:
field_oe_links:
weight: 3
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
type: link_default
region: content
oe_w_links_block_background:
weight: 1
settings: { }
third_party_settings: { }
type: options_select
region: content
oe_w_links_block_orientation:
weight: 0
settings: { }
third_party_settings: { }
type: options_select
region: content
field_oe_text:
weight: 2
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
hidden:
created: true
status: true
uid: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_list_item.field_oe_date
- field.field.paragraph.oe_list_item.field_oe_image
- field.field.paragraph.oe_list_item.field_oe_link
- field.field.paragraph.oe_list_item.field_oe_meta
- field.field.paragraph.oe_list_item.field_oe_text_long
- field.field.paragraph.oe_list_item.field_oe_title
- image.style.thumbnail
- paragraphs.paragraphs_type.oe_list_item
module:
- allowed_formats
- image
- link
- text
id: paragraph.oe_list_item.default
targetEntityType: paragraph
bundle: oe_list_item
mode: default
content:
field_oe_image:
type: image_image
weight: 3
region: content
settings:
progress_indicator: throbber
preview_image_style: thumbnail
third_party_settings: { }
field_oe_link:
type: link_default
weight: 0
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_meta:
type: string_textfield
weight: 4
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
field_oe_text_long:
type: text_textarea
weight: 2
region: content
settings:
rows: 3
placeholder: ''
third_party_settings:
allowed_formats:
hide_help: '1'
hide_guidelines: '1'
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
created: true
field_oe_date: true
status: true
translation: true
uid: true
langcode: en
status: true
dependencies:
config:
- field.field.paragraph.oe_list_item_block.field_oe_link
- field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout
- field.field.paragraph.oe_list_item_block.field_oe_paragraphs
- field.field.paragraph.oe_list_item_block.field_oe_title
- paragraphs.paragraphs_type.oe_list_item_block
module:
- link
- paragraphs
id: paragraph.oe_list_item_block.default
targetEntityType: paragraph
bundle: oe_list_item_block
mode: default
content:
field_oe_link:
type: link_default
weight: 3
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_list_item_block_layout:
type: options_select
weight: 0
region: content
settings: { }
third_party_settings: { }
field_oe_paragraphs:
type: paragraphs
weight: 2
region: content
settings:
title: Paragraph
title_plural: Paragraphs
edit_mode: closed
closed_mode: summary
autocollapse: none
closed_mode_threshold: 0
add_mode: dropdown
form_display_mode: default
default_paragraph_type: oe_list_item
features:
add_above: '0'
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
translation:
weight: 4
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
status: true
uid: true
langcode: en
status: true
dependencies:
config:
- core.entity_form_mode.paragraph.highlight
- field.field.paragraph.oe_list_item_block.field_oe_link
- field.field.paragraph.oe_list_item_block.field_oe_list_item_block_layout
- field.field.paragraph.oe_list_item_block.field_oe_paragraphs
- field.field.paragraph.oe_list_item_block.field_oe_title
- paragraphs.paragraphs_type.oe_list_item_block
module:
- link
- paragraphs
id: paragraph.oe_list_item_block.highlight
targetEntityType: paragraph
bundle: oe_list_item_block
mode: highlight
content:
field_oe_link:
type: link_default
weight: 3
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_oe_list_item_block_layout:
type: options_select
weight: 0
region: content
settings: { }
third_party_settings: { }
field_oe_paragraphs:
type: paragraphs
weight: 2
region: content
settings:
title: Paragraph
title_plural: Paragraphs
edit_mode: closed
closed_mode: summary
autocollapse: none
closed_mode_threshold: 0
add_mode: dropdown
form_display_mode: highlight
default_paragraph_type: oe_list_item
features:
add_above: '0'
collapse_edit_all: collapse_edit_all
duplicate: duplicate
third_party_settings: { }
field_oe_title:
type: string_textfield
weight: 1
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
translation:
weight: 4
region: content
settings: { }
third_party_settings: { }
hidden:
created: true
status: true
uid: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment