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

Update epic event v2 #1050

Merged
merged 28 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
01cbe08
EWPP-1863: Add list with illustrations pattern.
imanoleguskiza Jan 11, 2022
2ca33c6
EWPP-1863: Prepare icon in the template instead of pattern.
yenyasinn Jan 13, 2022
e6d6236
EWPP-1863: Fix review remarks and add support for flag icons.
imanoleguskiza Jan 16, 2022
64e9e85
EWPP-1863: Improve list with illustration assertion and add flag icon…
imanoleguskiza Jan 17, 2022
83f1f1f
EWPP-1863: Fix twig extension tests.
imanoleguskiza Jan 17, 2022
30bd00e
EWPP-1863: Use correct item and image classes on list with illustrati…
imanoleguskiza Jan 17, 2022
92a2198
EWPP-1863: Working list with illustration assert.
yenyasinn Jan 17, 2022
12216ca
Merge pull request #1006 from openeuropa/EWPP-1863
imanoleguskiza Jan 18, 2022
fa11443
EWPP-1861: Merge ECL 3.2 into list of illustrations.
yenyasinn Jan 25, 2022
b170f67
Merge pull request #1016 from openeuropa/update-EPIC-EWPP-1861-list-w…
yenyasinn Jan 25, 2022
a4ddf20
EWPP-1864: Style the lists with illustrations paragraphs.
yenyasinn Jan 17, 2022
ae6d16d
EWPP-1864: Update illustration list paragraph rendering from descript…
imanoleguskiza Jan 23, 2022
be76ae6
EWPP-1864: Remove illustration list variants.
imanoleguskiza Jan 23, 2022
78c78dd
EWPP-1864: Fix qa remarks.
imanoleguskiza Jan 24, 2022
5fbc6ca
EWPP-1864: Add "squared" option to Illustration list image.
yenyasinn Jan 26, 2022
51f83e0
EWPP-1864: Rename "squared" to "square_image".
yenyasinn Jan 27, 2022
e83bcb3
EWPP-1864: Do not show zebra style for horizontal view even if zebra …
yenyasinn Jan 28, 2022
4dd0d1e
EWPP-1864: Allow to use Media AV Portal Photo.
yenyasinn Jan 31, 2022
11c5820
Merge pull request #1017 from openeuropa/EWPP-1864-2
yenyasinn Feb 9, 2022
afe55b7
EWPP-1861: Merge 3.x into epic.
yenyasinn Feb 24, 2022
f5d3bd8
EWPP-1861: Add missing ecl/twig-component-list-illustration.
yenyasinn Feb 24, 2022
a2d7ad6
Merge pull request #1048 from openeuropa/update-EPIC-EWPP-1861-list-w…
yenyasinn Feb 24, 2022
67dd228
Merge pull request #1032 from openeuropa/EPIC-EWPP-1861-list-with-ill…
upchuk Feb 24, 2022
79d8548
EWPP-1849: Update test to reproduce issue.
sergepavle Feb 8, 2022
a5660e2
EWPP-1849: Fix javascript for contextual navigation pattern.
sergepavle Feb 9, 2022
87971e8
Merge pull request #1030 from openeuropa/EWPP-1849
upchuk Feb 25, 2022
e8d754d
EWPP-1539: Merge branch '3.x' into update-EPIC-Event-v2.
22Alexandra Mar 1, 2022
8b9bce3
EWPP-1539: Fix dependencies.
22Alexandra Mar 1, 2022
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
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"behat/behat": "^3.10",
"behat/mink-extension": "^2.3.1",
"composer/installers": "~1.5",
"composer/xdebug-handler": "^2.0",
"cweagans/composer-patches": "^1.7",
"drupal/address": "~1.9",
"drupal/composite_reference": "^2.1",
Expand Down Expand Up @@ -52,7 +53,7 @@
"openeuropa/oe_corporate_countries": "~2.0",
"openeuropa/oe_media": "^1.15",
"openeuropa/oe_multilingual": "^1.10",
"openeuropa/oe_paragraphs": "^1.11",
"openeuropa/oe_paragraphs": "dev-master",
"openeuropa/oe_search": "^1.9",
"openeuropa/oe_webtools": "^1.15",
"openeuropa/rdf_skos": "^1.0",
Expand Down Expand Up @@ -112,7 +113,8 @@
"Explicit minimum version requirement of drupal/ctools module due to D9.2 compatability.",
"Explicit minimum version requirement of behat library due to PHP compatibility.",
"Explicit requirement for egulias/email-validator due to https://www.drupal.org/project/drupal/issues/3061074#comment-14300579. It can be removed when Drupal core 9.2 support is droppped.",
"Explicit minimum version requirement for symfony/dom-crawler due to its lower versions using the deprecated function libxml_disable_entity_loader() in PHP8."
"Explicit minimum version requirement for symfony/dom-crawler due to its lower versions using the deprecated function libxml_disable_entity_loader() in PHP8.",
"Requiring composer/xdebug-handler until PHPMD 2.12 is released"
]
},
"config": {
Expand Down
313 changes: 102 additions & 211 deletions modules/oe_theme_helper/src/TwigExtension/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,210 +275,19 @@ public function toEclAttributes($attributes): array {
* Icon array for ECL components containing icon name, path and rotation.
*/
public function toEclIcon(array $context, $icon, string $size = ''): array {
$path = $context['ecl_icon_path'];
$social_path = $context['ecl_icon_social_media_path'];

// ECL supported icons naming and rotation.
$icons = [
'facebook' => [
'name' => 'facebook',
'social' => TRUE,
],
'instagram' => [
'name' => 'instagram',
'social' => TRUE,
],
'linkedin' => [
'name' => 'linkedin',
'social' => TRUE,
],
'pinterest' => [
'name' => 'pinterest',
'social' => TRUE,
],
'rss' => [
'name' => 'rss',
],
'skype' => [
'name' => 'skype',
'social' => TRUE,
],
'twitter' => [
'name' => 'twitter',
'social' => TRUE,
],
'youtube' => [
'name' => 'youtube',
'social' => TRUE,
],
'audio' => [
'name' => 'audio',
],
'book' => [
'name' => 'book',
],
'brochure' => [
'name' => 'brochure',
],
'budget' => [
'name' => 'budget',
],
'calendar' => [
'name' => 'calendar',
],
'copy' => [
'name' => 'copy',
],
'data' => [
'name' => 'data',
],
'digital' => [
'name' => 'digital',
],
'edit' => [
'name' => 'edit',
],
'energy' => [
'name' => 'energy',
],
'euro' => [
'name' => 'euro',
],
'faq' => [
'name' => 'faq',
],
'feedback' => [
'name' => 'feedback',
],
'file' => [
'name' => 'file',
],
'gear' => [
'name' => 'gear',
],
'generic-lang' => [
'name' => 'generic-lang',
],
'global' => [
'name' => 'global',
],
$path = $this->getIconPath($context, $icon);

// Icons that require transforming.
$transformed_icons = [
'googleplus' => [
'name' => 'digital',
],
'growth' => [
'name' => 'growth',
],
'hamburger' => [
'name' => 'hamburger',
],
'image' => [
'name' => 'image',
],
'infographic' => [
'name' => 'infographic',
],
'language' => [
'name' => 'language',
],
'livestreaming' => [
'name' => 'livestreaming',
],
'location' => [
'name' => 'location',
],
'log-in' => [
'name' => 'log-in',
],
'logged-in' => [
'name' => 'logged-in',
],
'multiple-files' => [
'name' => 'multiple-files',
],
'organigram' => [
'name' => 'organigram',
],
'package' => [
'name' => 'package',
],
'presentation' => [
'name' => 'presentation',
],
'print' => [
'name' => 'print',
],
'regulation' => [
'name' => 'regulation',
],
'search' => [
'name' => 'search',
],
'share' => [
'name' => 'share',
],
'slides' => [
'name' => 'presentation',
],
'spinner' => [
'name' => 'spinner',
],
'spreadsheet' => [
'name' => 'spreadsheet',
],
'video' => [
'name' => 'video',
],
'camera' => [
'name' => 'video',
],
'error' => [
'name' => 'error',
],
'information' => [
'name' => 'information',
],
'info' => [
'name' => 'information',
],
'success' => [
'name' => 'success',
],
'warning' => [
'name' => 'warning',
],
'check' => [
'name' => 'check',
],
'check-filled' => [
'name' => 'check-filled',
],
'close' => [
'name' => 'close',
],
'close-filled' => [
'name' => 'close-filled',
],
'corner-arrow' => [
'name' => 'corner-arrow',
],
'download' => [
'name' => 'download',
],
'external' => [
'name' => 'external',
],
'fullscreen' => [
'name' => 'fullscreen',
],
'minus' => [
'name' => 'minus',
],
'plus' => [
'name' => 'plus',
],
'solid-arrow' => [
'name' => 'solid-arrow',
],
'close-dark' => [
'name' => 'close-filled',
],
Expand Down Expand Up @@ -516,30 +325,112 @@ public function toEclIcon(array $context, $icon, string $size = ''): array {
],
];

if (array_key_exists($icon, $icons)) {
$icons[$icon]['path'] = $path;
if (isset($icons[$icon]['social']) && $icons[$icon]['social']) {
$icons[$icon]['path'] = $social_path;
}
// Check whether the icon needs any transformation.
if (array_key_exists($icon, $transformed_icons)) {
$transformed_icons[$icon]['path'] = $path;
if ($size) {
$icons[$icon]['size'] = $size;
$transformed_icons[$icon]['size'] = $size;
}

return $icons[$icon];
return $transformed_icons[$icon];
}

// We define a default icon if one is not provided.
if (!$icon) {
$icon = 'digital';
}
$icon = [
'name' => $icon,
'path' => $path,
];
if ($size) {
return [
'name' => 'digital',
'path' => $path,
'size' => $size,
];
$icon['size'] = $size;

}
return $icon;
}

return [
'name' => 'digital',
'path' => $path,
/**
* Returns the file path for an ECL icon.
*
* @param array $context
* The twig context.
* @param string $icon
* The icon to be converted.
*
* @return string
* ECL icon file path.
*/
protected function getIconPath(array $context, string $icon): string {
// Flag icon names.
$flag_icons = [
'austria',
'belgium',
'bulgaria',
'croatia',
'cyprus',
'czech-republic',
'denmark',
'estonia',
'EU',
'finland',
'france',
'germany',
'greece',
'hungary',
'ireland',
'italy',
'latvia',
'lithuania',
'luxembourg',
'malta',
'netherlands',
'poland',
'portugal',
'romania',
'slovakia',
'slovenia',
'spain',
'sweden',
];
// Flag icons can have a -square string appended, so check if the icon name
// starts with a country name.
$found_icon = array_filter($flag_icons, function ($var) use ($icon) {
if (strpos($icon, $var) === 0) {
return TRUE;
};
return FALSE;
});
if ($found_icon) {
return $context['ecl_icon_flag_path'];
}

// Social media icon names.
$social_icons = [
'blog',
'facebook',
'flickr',
'foursquare',
'instagram',
'linkedin',
'pinterest',
'reddit',
'skype',
'spotify',
'twitter',
'youtube',
];
// Social icons can have a -color or a -negative string appended,
// so check if the icon name starts with a social name.
$found_icon = array_filter($social_icons, function ($var) use ($icon) {
if (strpos($icon, $var) === 0) {
return TRUE;
};
return FALSE;
});
if ($found_icon) {
return $context['ecl_icon_social_media_path'];
}
return $context['ecl_icon_path'];
}

/**
Expand Down
Loading