Skip to content

Commit

Permalink
Merge branch '3.x' into EWPP-3678-build-dev-ecl
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarco committed Nov 15, 2023
2 parents 715f58f + 3af3d20 commit 06d9835
Show file tree
Hide file tree
Showing 28 changed files with 271 additions and 132 deletions.
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"openeuropa/oe_content": "3.x-dev",
"openeuropa/oe_corporate_blocks": "^4.14",
"openeuropa/oe_corporate_countries": "^2.0.0-alpha8",
"openeuropa/oe_corporate_site_info": "^1.0",
"openeuropa/oe_media": "^1.23.1",
"openeuropa/oe_multilingual": "^1.13",
"openeuropa/oe_paragraphs": "^1.20",
Expand Down Expand Up @@ -102,6 +103,9 @@
},
"drupal/entity_reference_revisions": {
"https://www.drupal.org/project/entity_reference_revisions/issues/2937835": "https://www.drupal.org/files/issues/2021-03-26/entity_reference_revisions-field_formatter_label-2937835-36.patch"
},
"openeuropa/oe_corporate_site_info": {
"latest-master": "https://github.com/openeuropa/oe_corporate_site_info/compare/1.0.0-alpha7...1.x.diff"
}
},
"drupal-scaffold": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getThumbnail(MediaInterface $media): ?ImageValueObjectInterface
/** @var \Drupal\oe_theme\ValueObject\ImageValueObject $thumbnail */
return ImageValueObject::fromArray([
'src' => \Drupal::service('file_url_generator')->generateString($uri),
'alt' => $source->getMetadata($media, 'thumbnail_alt_value') ?? $media->label(),
'alt' => $source->getMetadata($media, 'thumbnail_alt_value') ?? '',
'name' => $media->getName(),
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function testWysiwygTable(): void {
$this->click('#cke_edit-oe-teaser-0-value .cke_button__source');
$page->find('css', 'textarea.cke_source')->setValue('test');
$page->fillField('Content owner (value 1)', 'Audit Board of the European Communities (http://publications.europa.eu/resource/authority/corporate-body/ABEC)');
$page->fillField('Subject (value 1)', 'financing (http://data.europa.eu/uxp/1000)');
$page->fillField('Subject tags (value 1)', 'financing (http://data.europa.eu/uxp/1000)');
$page->pressButton('Save');
$web_assert->elementExists('css', 'article .ecl table.ecl-table.ecl-table--simple.ecl-table--zebra');
// Assert absence of classes in table related to "Zebra striping" and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function testFormatter(): void {
$expected_thumbnail_name = 'FRPRzhRHyt8zGp5-d-luvJDnIb03oXDJUp5LtL4UeDI.jpg';

$image_node = $items->eq(1)->filter('img');
$this->assertEquals("Energy, let's save it!", $image_node->attr('alt'));
$this->assertEquals('', $image_node->attr('alt'));
$this->assertStringEndsWith('/oembed_thumbnails/' . $expected_thumbnail_name, $image_node->attr('src'));
$caption = $items->eq(1)->filter('.ecl-gallery__description');
$this->assertStringContainsString($video_media->label(), $caption->html());
Expand Down Expand Up @@ -333,7 +333,7 @@ public function testFormatter(): void {
);
}
$image_node = $items->eq(1)->filter('img');
$this->assertEquals("Energy, let's save it!", $image_node->attr('alt'));
$this->assertEquals('', $image_node->attr('alt'));
$this->assertStringContainsString(
'/files/styles/medium/public/oembed_thumbnails/' . $expected_thumbnail_name . '?itok=',
$image_node->attr('src')
Expand Down
46 changes: 44 additions & 2 deletions oe_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use Drupal\media_avportal\Plugin\media\Source\MediaAvPortalSourceInterface;
use Drupal\media_avportal\Plugin\media\Source\MediaAvPortalVideoSource;
use Drupal\node\NodeInterface;
use Drupal\oe_content_person\Entity\PersonJobInterface;
use Drupal\oe_corporate_site_info\SiteInformation;
use Drupal\oe_media_iframe\Plugin\media\Source\Iframe;
use Drupal\oe_theme\DocumentMediaValueExtractor;
use Drupal\oe_theme\ValueObject\DateValueObject;
Expand Down Expand Up @@ -1661,7 +1662,7 @@ function oe_theme_preprocess_paragraph__oe_banner(array &$variables): void {

$values = [
'src' => $style->buildUrl($uri),
'alt' => $source->getMetadata($media, 'thumbnail_alt_value') ?? $media->label(),
'alt' => $source->getMetadata($media, 'thumbnail_alt_value') ?? '',
'name' => $media->getName(),
];
$variables['image'] = ImageValueObject::fromArray($values);
Expand Down Expand Up @@ -1693,7 +1694,7 @@ function oe_theme_theme_suggestions_page_alter(array &$suggestions, array $varia
function oe_theme_preprocess_page(array &$variables): void {
$variables['site_name'] = \Drupal::config('system.site')->get('name');
$variables['main_attributes'] = new Attribute([
'class' => ['ecl-u-pb-xl ecl-u-pt-m'],
'class' => ['ecl-u-pb-xl'],
'id' => ['main-content'],
]);
}
Expand Down Expand Up @@ -1784,6 +1785,7 @@ function oe_theme_preprocess_oe_corporate_blocks_ec_footer(array &$variables) {
$variables['path'] = 'https://commission.europa.eu/index_' . EuropeanUnionLanguages::getInternalLanguageCode($variables['current_language_id']);
}
_oe_theme_preprocess_site_specific_footer_links($variables);
_oe_theme_preprocess_accessibility_link($variables);
}

/**
Expand All @@ -1804,6 +1806,7 @@ function oe_theme_preprocess_oe_corporate_blocks_eu_footer(array &$variables) {
$variables['mobile_logo_path'] = str_replace('standard', 'condensed', $variables['desktop_logo_path']);

_oe_theme_preprocess_site_specific_footer_links($variables);
_oe_theme_preprocess_accessibility_link($variables);
}

/**
Expand Down Expand Up @@ -1868,6 +1871,44 @@ function _oe_theme_preprocess_site_specific_footer_links(array &$variables): voi
}
}

/**
* Get the Accessibility statement link.
*/
function _oe_theme_preprocess_accessibility_link(array &$variables) {
if (!\Drupal::service('module_handler')->moduleExists('oe_corporate_site_info')) {
return;
}
$cacheability = CacheableMetadata::createFromRenderArray($variables);
$configuration = \Drupal::configFactory()->get(SiteInformation::CONFIG_NAME);
$cacheability->addCacheableDependency($configuration);
/** @var \Drupal\oe_corporate_site_info\SiteInformationInterface $site_information */
$site_information = \Drupal::service('oe_corporate_site_info.site_information');
if (!$site_information->hasAccessibilityLink()) {
$cacheability->applyTo($variables);
return;
}
$uri = $site_information->getAccessibilityLink();
$uri_parts = parse_url($uri);
if ($uri_parts['scheme'] === 'entity') {
[$entity_type_id, $entity_id] = explode('/', $uri_parts['path'], 2);
$entity = \Drupal::entityTypeManager()->getStorage($entity_type_id)->load($entity_id);
if ($entity instanceof NodeInterface) {
$cacheability->addCacheableDependency($entity);
$access = $entity->access('view', \Drupal::currentUser(), TRUE);
$cacheability->addCacheableDependency($access);
if (!$access->isAllowed()) {
$cacheability->applyTo($variables);
// Do not show the button if access to the node is forbidden.
return;
}
}
}
$url = Url::fromUri($uri)->toString();

$variables['accessibility_link'] = $url;
$cacheability->applyTo($variables);
}

/**
* Implements hook_preprocess_HOOK().
*/
Expand Down Expand Up @@ -2181,6 +2222,7 @@ function oe_theme_preprocess_paragraph__oe_carousel(array &$variables): void {
'url' => $link ?? '',
'url_text' => $link_text ?? '',
'image' => $image_url,
'image_alt' => $source->getMetadata($media, 'thumbnail_alt_value') ?? '',
'centered' => FALSE,
// The paragraph has a required image field, so we need to set a default
// image variant in order to render the image.
Expand Down
102 changes: 51 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,64 +14,64 @@
"prepare": "patch-package"
},
"dependencies": {
"@ecl/builder": "3.10.0",
"@ecl/preset-ec": "3.10.0",
"@ecl/preset-eu": "3.10.0",
"@ecl/preset-reset": "3.10.0",
"@ecl/builder": "3.11.0",
"@ecl/preset-ec": "3.11.0",
"@ecl/preset-eu": "3.11.0",
"@ecl/preset-reset": "3.11.0",
"@ecl/stylelint-config": "0.2.1",
"@ecl/theme-ec": "3.10.0",
"@ecl/theme-eu": "3.10.0",
"@ecl/twig-component-accordion": "3.10.0",
"@ecl/twig-component-banner": "3.10.0",
"@ecl/twig-component-blockquote": "3.10.0",
"@ecl/twig-component-breadcrumb": "3.10.0",
"@ecl/twig-component-button": "3.10.0",
"@ecl/twig-component-card": "3.10.0",
"@ecl/twig-component-carousel": "3.10.0",
"@ecl/twig-component-content-item": "3.10.0",
"@ecl/twig-component-datepicker": "3.10.0",
"@ecl/twig-component-description-list": "3.10.0",
"@ecl/twig-component-expandable": "3.10.0",
"@ecl/twig-component-fact-figures": "3.10.0",
"@ecl/twig-component-featured-item": "3.10.0",
"@ecl/twig-component-file": "3.10.0",
"@ecl/twig-component-gallery": "3.10.0",
"@ecl/twig-component-hero-banner": "3.10.0",
"@ecl/twig-component-icon": "3.10.0",
"@ecl/twig-component-inpage-navigation": "3.10.0",
"@ecl/twig-component-label": "3.10.0",
"@ecl/twig-component-language-list": "3.10.0",
"@ecl/twig-component-link": "3.10.0",
"@ecl/twig-component-list-illustration": "3.10.0",
"@ecl/twig-component-media-container": "3.10.0",
"@ecl/twig-component-menu": "3.10.0",
"@ecl/twig-component-message": "3.10.0",
"@ecl/twig-component-navigation-list": "3.10.0",
"@ecl/twig-component-news-ticker": "3.10.0",
"@ecl/twig-component-page-banner": "3.10.0",
"@ecl/twig-component-page-header": "3.10.0",
"@ecl/twig-component-pagination": "3.10.0",
"@ecl/twig-component-radio": "3.10.0",
"@ecl/twig-component-search-form": "3.10.0",
"@ecl/twig-component-select": "3.10.0",
"@ecl/twig-component-site-footer": "3.10.0",
"@ecl/twig-component-site-header": "3.10.0",
"@ecl/twig-component-skip-link": "3.10.0",
"@ecl/twig-component-social-media-follow": "3.10.0",
"@ecl/twig-component-social-media-share": "3.10.0",
"@ecl/twig-component-table": "3.10.0",
"@ecl/twig-component-tag": "3.10.0",
"@ecl/twig-component-text-input": "3.10.0",
"@ecl/twig-component-timeline": "3.10.0",
"@ecl/vanilla-utility-background": "3.10.0",
"@ecl/vanilla-utility-border": "3.10.0",
"@ecl/theme-ec": "3.11.0",
"@ecl/theme-eu": "3.11.0",
"@ecl/twig-component-accordion": "3.11.0",
"@ecl/twig-component-banner": "3.11.0",
"@ecl/twig-component-blockquote": "3.11.0",
"@ecl/twig-component-breadcrumb": "3.11.0",
"@ecl/twig-component-button": "3.11.0",
"@ecl/twig-component-card": "3.11.0",
"@ecl/twig-component-carousel": "3.11.0",
"@ecl/twig-component-content-item": "3.11.0",
"@ecl/twig-component-datepicker": "3.11.0",
"@ecl/twig-component-description-list": "3.11.0",
"@ecl/twig-component-expandable": "3.11.0",
"@ecl/twig-component-fact-figures": "3.11.0",
"@ecl/twig-component-featured-item": "3.11.0",
"@ecl/twig-component-file": "3.11.0",
"@ecl/twig-component-gallery": "3.11.0",
"@ecl/twig-component-hero-banner": "3.11.0",
"@ecl/twig-component-icon": "3.11.0",
"@ecl/twig-component-inpage-navigation": "3.11.0",
"@ecl/twig-component-label": "3.11.0",
"@ecl/twig-component-language-list": "3.11.0",
"@ecl/twig-component-link": "3.11.0",
"@ecl/twig-component-list-illustration": "3.11.0",
"@ecl/twig-component-media-container": "3.11.0",
"@ecl/twig-component-menu": "3.11.0",
"@ecl/twig-component-message": "3.11.0",
"@ecl/twig-component-navigation-list": "3.11.0",
"@ecl/twig-component-news-ticker": "3.11.0",
"@ecl/twig-component-page-banner": "3.11.0",
"@ecl/twig-component-page-header": "3.11.0",
"@ecl/twig-component-pagination": "3.11.0",
"@ecl/twig-component-radio": "3.11.0",
"@ecl/twig-component-search-form": "3.11.0",
"@ecl/twig-component-select": "3.11.0",
"@ecl/twig-component-site-footer": "3.11.0",
"@ecl/twig-component-site-header": "3.11.0",
"@ecl/twig-component-skip-link": "3.11.0",
"@ecl/twig-component-social-media-follow": "3.11.0",
"@ecl/twig-component-social-media-share": "3.11.0",
"@ecl/twig-component-table": "3.11.0",
"@ecl/twig-component-tag": "3.11.0",
"@ecl/twig-component-text-input": "3.11.0",
"@ecl/twig-component-timeline": "3.11.0",
"@ecl/vanilla-utility-background": "3.11.0",
"@ecl/vanilla-utility-border": "3.11.0",
"chokidar-cli": "3.0.0",
"grunt": "1.6.1",
"grunt-contrib-copy": "1.0.0",
"moment": "2.29.1",
"node-sass": "8.0.0",
"npm-run-all": "4.1.5",
"patch-package": "^5.1.2",
"patch-package": "8.0.0",
"stylelint": "9.1.1",
"stylelint-config-prettier": "2.1.0",
"stylelint-no-browser-hacks": "^1.1.0",
Expand Down
29 changes: 0 additions & 29 deletions patches/@ecl/twig-component-file+3.10.0.patch

This file was deleted.

12 changes: 12 additions & 0 deletions patches/@ecl/twig-component-gallery+3.11.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
patch-package
--- a/node_modules/@ecl/twig-component-gallery/gallery-item.html.twig
+++ b/node_modules/@ecl/twig-component-gallery/gallery-item.html.twig
@@ -51,7 +51,7 @@
},
}})
%}
- {% if _item.image.alt is not empty %}
+ {% if _item.image.alt is defined %}
{% set _item = _item|merge({
picture: _item.picture|merge({
img: _item.picture.img|merge({
12 changes: 12 additions & 0 deletions patches/@ecl/twig-component-media-container+3.11.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
patch-package
--- a/node_modules/@ecl/twig-component-media-container/media-container.html.twig
+++ b/node_modules/@ecl/twig-component-media-container/media-container.html.twig
@@ -69,7 +69,7 @@
},
}
%}
- {% if _alt is not empty %}
+ {% if _alt is defined %}
{% set _picture = _picture|merge({
img: _picture.img|merge({
alt: _alt
12 changes: 12 additions & 0 deletions patches/@ecl/twig-component-picture+3.11.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
patch-package
--- a/node_modules/@ecl/twig-component-picture/picture.html.twig
+++ b/node_modules/@ecl/twig-component-picture/picture.html.twig
@@ -81,7 +81,7 @@
{% if _picture.img.src is not empty %}
src="{{ _picture.img.src }}"
{% endif %}
- {% if _picture.img.alt is not empty %}
+ {% if _picture.img.alt is defined %}
alt="{{ _picture.img.alt }}"
{% endif %}
/>
29 changes: 0 additions & 29 deletions patches/@ecl/twig-component-site-footer+3.10.0.patch

This file was deleted.

30 changes: 30 additions & 0 deletions patches/@ecl/twig-component-site-footer+3.11.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/node_modules/@ecl/twig-component-site-footer/site-footer.html.twig b/node_modules/@ecl/twig-component-site-footer/site-footer.html.twig
index 761c4da..c6f58fd 100644
--- a/node_modules/@ecl/twig-component-site-footer/site-footer.html.twig
+++ b/node_modules/@ecl/twig-component-site-footer/site-footer.html.twig
@@ -6,6 +6,8 @@
- "section_class_name" (string) (default: '')
- "logo" (EU only)
- "alt" (string) alt attribute for the logo link
+ - "aria_label" (string) aria-label attribute for the logo link
+ - "title" (string) title attribute for the logo img
- "path" (string) logo link path
- "language" (string) Language code
- "src_mobile" (string) Path the mobile logo
@@ -101,7 +103,7 @@
path: _sections.logo.path,
label: _label,
type: 'standalone',
- aria_label: _sections.logo.title
+ aria_label: _sections.logo.aria_label,
},
extra_classes: 'ecl-site-footer__logo-link'
} only %}
@@ -149,6 +151,7 @@
{% endif %}
{% include '@ecl/link/link.html.twig' with _item|merge({
link: _item.link|default({})|merge({ type: 'standalone' }),
+ icon: _item.icon|default({})|merge({ size: 'xs' }),
extra_classes: 'ecl-site-footer__link',
}) only %}
{% if _item.content_after is defined and _item.content_after is not empty %}
Loading

0 comments on commit 06d9835

Please sign in to comment.