Skip to content

Commit

Permalink
Merge pull request #1420 from openeuropa/EWPP-4137
Browse files Browse the repository at this point in the history
EWPP-4137: Cleanup deprecated patterns and fields and update README.
  • Loading branch information
22Alexandra authored Mar 8, 2024
2 parents cd05cda + c1b2d5d commit 1955e4c
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 463 deletions.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://drone.fpfis.eu/api/badges/openeuropa/oe_theme/status.svg?branch=master)](https://drone.fpfis.eu/openeuropa/oe_theme)
[![Packagist](https://img.shields.io/packagist/v/openeuropa/oe_theme.svg)](https://packagist.org/packages/openeuropa/oe_theme)

Drupal 8 and 9 theme based on the [Europa Component Library][1] (ECL).
Drupal 10 theme based on the [Europa Component Library][1] (ECL).

**Table of contents:**

Expand Down Expand Up @@ -111,6 +111,44 @@ Each component library can use one of the following ECL brandings:

To learn more about EC/EU families and ECL branding visit the [ECL website](https://ec.europa.eu/component-library).

### Upgrade to 4.0.0

#### The following patterns have been removed:
- `banner_hero`
- `banner_page`
- `social_media_links_horizontal`
- `social_media_links_vertical`

#### The following variants of the button pattern have been removed:
- `form`
- `form_primary`
- `splash_page`

The `language_switcher` field of the `page_header` pattern has been removed.
The `additional_information` field of the `list_item` pattern has been removed.
The `text_highlight` and `image_overlay` variants fo the `banner` pattern have been replaced by a single variant
`text_overlay`.

#### Two ECL components have been replaced:
- Message component (`twig-component-message`) replaced by Notification component (`twig-component-notification`)
- Language list component (`twig-component-language-list`) replaced by Splash page (`twig-component-splash-page`)

#### Colors
In order to accommodate the color changes in ECL 4.0.0 we have added two twig functions to determine the correct color
for border and background based on the component library (European Union or European Commission):
- `ecl_class_border_color`
- `ecl_class_background_color`
The grey color used in typography case has been replaced with dark.

#### New patterns
- Highlighted list pattern (`highlighted_list`) - used for displaying a main highlighted item along with 3
secondary items placed on the right side of the page. All the items are using the `list_item` pattern's structure
with `default`.
- Tabs pattern (`tabs`) - used mainly for navigation links. We are using this to render the Drupal local tasks.

#### Content display changes
All the teaser templates are using the vertical variant for displaying the lists.

### Upgrade to 3.0.0

#### Page header pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* This formatter assumes that link categories will be compatible with
* media service names used in the "Social media links: horizontal" pattern.
*
* @see templates/patterns/social_media_links/social_media_links_horizontal.ui_patterns.yml
* @see templates/patterns/social_media_links/social_media_links.ui_patterns.yml
*
* @FieldFormatter(
* id = "oe_theme_helper_social_media_links_formatter",
Expand Down Expand Up @@ -90,7 +90,8 @@ public function viewElements(FieldItemListInterface $items, $langcode) {

$pattern = [
'#type' => 'pattern',
'#id' => 'social_media_links_' . $this->getSetting('variant'),
'#id' => 'social_media_links',
'#variant' => $this->getSetting('variant'),
'#fields' => [
'title' => $this->getSetting('title'),
'links' => [],
Expand Down
9 changes: 1 addition & 8 deletions modules/oe_theme_helper/src/TwigExtension/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,7 @@ protected function getIconPath(array $context, string $icon): string {
* @return mixed
* The trimmed output.
*/
public function smartTrim(Environment $env, $input, $limit = 0) {
if ($limit === NULL) {
// phpcs:disable Drupal.Semantics.FunctionTriggerError
@trigger_error('Using the smart_trim filter with a null limit value is deprecated in oe_theme:3.x and will be removed in oe_theme:4.x releases.', E_USER_DEPRECATED);
// phpcs:enable
$limit = 0;
}

public function smartTrim(Environment $env, $input, int $limit = 0) {
// Bubbles Twig template argument's cacheability & attachment metadata.
$this->bubbleArgMetadata($input);
$truncate = new TruncateHTML();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function smartTrimFilterDataProvider(): array {
],
'Do not trim a string if length is NULL' => [
'variables' => [
'length' => NULL,
'length' => 0,
'content' => 'This is a very long text that is not going to be trimmed.',
],
'assertions' => [
Expand Down Expand Up @@ -168,7 +168,7 @@ public function smartTrimFilterDataProvider(): array {
],
'Do not trim a plain_text render array when length is NULL' => [
'variables' => [
'length' => NULL,
'length' => 0,
'content' => [
'#plain_text' => 'This is a very long text that is not going to be trimmed.',
],
Expand Down
75 changes: 0 additions & 75 deletions templates/patterns/banners/banner_hero.ui_patterns.yml

This file was deleted.

64 changes: 0 additions & 64 deletions templates/patterns/banners/banner_page.ui_patterns.yml

This file was deleted.

62 changes: 0 additions & 62 deletions templates/patterns/banners/pattern-banner-hero.html.twig

This file was deleted.

51 changes: 0 additions & 51 deletions templates/patterns/banners/pattern-banner-page.html.twig

This file was deleted.

9 changes: 0 additions & 9 deletions templates/patterns/button/button.ui_patterns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ button:
search:
label: "Search"
description: "Search button."
form:
label: "Form (deprecated)"
description: "The form buttons are used to confirm a choice or send information. This was deprecated in ECL 2.x."
form_primary:
label: "Form primary (deprecated)"
description: "The form buttons are used to confirm a choice or send information. This was deprecated in ECL 2.x."
splash_page:
label: "Splash page (deprecated)"
description: "Special buttons used on the site's splash page. This was deprecated in ECL 2.x."
fields:
type_attribute:
type: "text"
Expand Down
Loading

0 comments on commit 1955e4c

Please sign in to comment.