diff --git a/composer.json b/composer.json index 1dffc0b77..c37606cba 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "openeuropa/behat-transformation-context": "^0.2", "openeuropa/code-review": "^2.0.0-alpha6", "openeuropa/oe_contact_forms": "^1.11", - "openeuropa/oe_content": "^3.0.0-beta4", + "openeuropa/oe_content": "^3.0.0", "openeuropa/oe_corporate_blocks": "^4.14", "openeuropa/oe_corporate_countries": "^2.0.0-alpha8", "openeuropa/oe_corporate_site_info": "^1.0.0-alpha8", @@ -103,6 +103,13 @@ "https://www.drupal.org/project/address/issues/3144823": "https://www.drupal.org/files/issues/2020-11-05/3144823-6.patch" } }, + "patches-ignore": { + "openeuropa/oe_content": { + "drupal/core": { + "Drupal 10.2.x only - see oe_content/README.md for 10.1.x - https://www.drupal.org/project/drupal/issues/2230909": "https://www.drupal.org/files/issues/2023-12-21/2230909-309.patch" + } + } + }, "drupal-scaffold": { "locations": { "web-root": "./build" diff --git a/patches/@ecl/twig-component-content-block+3.13.0.patch b/patches/@ecl/twig-component-content-block+3.13.0.patch new file mode 100644 index 000000000..f8c2847c2 --- /dev/null +++ b/patches/@ecl/twig-component-content-block+3.13.0.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/@ecl/twig-component-content-block/content-block.html.twig b/node_modules/@ecl/twig-component-content-block/content-block.html.twig +index 141368d..8fffb43 100644 +--- a/node_modules/@ecl/twig-component-content-block/content-block.html.twig ++++ b/node_modules/@ecl/twig-component-content-block/content-block.html.twig +@@ -147,6 +147,7 @@ + link: _link.link|merge({ + type: 'standalone', + }), ++ extra_attributes: _link.extra_attributes|default([]), + icon: _link.icon|default({}) + } only %} + {%- else -%} +@@ -165,6 +166,7 @@ + link: _link.link|merge({ + type: 'standalone', + }), ++ extra_attributes: _link.extra_attributes|default([]), + icon: _link.icon|default({}) + } only %} + {%- else -%} diff --git a/patches/@ecl/twig-component-menu+3.13.0.patch b/patches/@ecl/twig-component-menu+3.13.0.patch index a49af4858..ac165adaf 100644 --- a/patches/@ecl/twig-component-menu+3.13.0.patch +++ b/patches/@ecl/twig-component-menu+3.13.0.patch @@ -63,7 +63,7 @@ index 6891f9e..0944464 100644 {{- child.label -}} {%- if child.external -%} diff --git a/templates/patterns/navigation_list/navigation_list.ui_patterns.yml b/templates/patterns/navigation_list/navigation_list.ui_patterns.yml index 2a2180755..86f2e1e4e 100644 --- a/templates/patterns/navigation_list/navigation_list.ui_patterns.yml +++ b/templates/patterns/navigation_list/navigation_list.ui_patterns.yml @@ -30,6 +30,9 @@ navigation_list: - label: 'Addressing shared challenges' url: 'https://commission.europa.eu/education/policy-educational-issues/shared-challenges-education-and-training_en' is_external: true + extra_attributes: + - name: "extra-attr2" + value: "extra value2" - label: 'Setting objectives and measuring progress' url: 'https://commission.europa.eu/education/policy-educational-issues/setting-objectives-and-measuring-progress_en' - label: 'International cooperation' @@ -42,6 +45,9 @@ navigation_list: preview: - label: 'Integrating migrants and refugees' url: 'https://commission.europa.eu/education/policy-educational-issues/shared-challenges-education-and-training/integrating-migrants-and-refugees_en' + extra_attributes: + - name: "extra-attr2" + value: "extra value2" - label: 'Early school leaving' url: 'https://commission.europa.eu/education/policy-educational-issues/shared-challenges-education-and-training/early-school-leaving_en' is_external: true @@ -57,3 +63,11 @@ navigation_list: preview: src: "https://loremflickr.com/1000/500/arch" alt: "Alternative text for image" + extra_attributes: + type: "array" + label: "Extra attributes" + description: "List of extra attributes used in ECL component" + preview: + - name: "extra-attr" + value: "extra value" + diff --git a/templates/patterns/navigation_list/pattern-navigation-list.html.twig b/templates/patterns/navigation_list/pattern-navigation-list.html.twig index 4a0cfeb5b..edc62323b 100644 --- a/templates/patterns/navigation_list/pattern-navigation-list.html.twig +++ b/templates/patterns/navigation_list/pattern-navigation-list.html.twig @@ -24,7 +24,8 @@ path : link.url, icon_path: ecl_icon_path, external: link.is_external|default(false) - } + }, + extra_attributes: link.extra_attributes|default([]) } %} {% set _primary_links = _primary_links|merge([_link]) %} {% endfor %} @@ -40,7 +41,8 @@ path : secondary_link.url, icon_path: ecl_icon_path, external: secondary_link.is_external|default(false) - } + }, + extra_attributes: secondary_link.extra_attributes|default([]) } %} {% set _secondary_links = _secondary_links|merge([_secondary_link]) %} {% endfor %} @@ -60,5 +62,6 @@ 'description': description|default(''), 'links': _links, 'border': border|default(false), - 'picture': _image + 'picture': _image, + 'extra_attributes': extra_attributes|default([]) } only %} diff --git a/tests/src/Kernel/fixtures/rendering.yml b/tests/src/Kernel/fixtures/rendering.yml index dfadc0f9e..b22f3450c 100644 --- a/tests/src/Kernel/fixtures/rendering.yml +++ b/tests/src/Kernel/fixtures/rendering.yml @@ -1786,12 +1786,18 @@ '#fields': title: 'Navigation list title' title_url: 'http://example.com' + extra_attributes: + - name: "extra-attr1" + value: "extra value1" external_link: true description: 'Navigation list description' links: - label: 'Child 1' url: 'http://example.com/child1' is_external: true + extra_attributes: + - name: "extra-attr1" + value: "extra value1" - label: 'Child 2' url: 'http://example.com/child2' - label: 'Child 3' @@ -1800,6 +1806,9 @@ - label: 'Secondary Link 1' url: 'http://example.com/secondary1' is_external: true + extra_attributes: + - name: "extra-attr2" + value: "extra value2" - label: 'Secondary Link 2' url: 'http://example.com/secondary2' border: true @@ -1826,6 +1835,9 @@ 'li.ecl-content-block__link-item': 5 "img.ecl-navigation-list__image[src=\"https://placeimg.com/1000/500/arch\"]": 1 'img.ecl-navigation-list__image[alt="Alternative text for image"]': 1 + '.ecl-content-block__link-list:nth-child(1) li.ecl-content-block__link-item:nth-child(1) a.ecl-link[extra-attr1="extra value1"]': 1 + '.ecl-content-block__link-list:nth-child(2) li.ecl-content-block__link-item:nth-child(1) a.ecl-link[extra-attr2="extra value2"]': 1 + 'article.ecl-navigation-list__item[extra-attr="extra value"]': 1 - array: '#type': pattern '#id': navigation_list @@ -3124,10 +3136,10 @@ '.ecl-menu__inner-header button.ecl-menu__close .ecl-button__label': "Close" '.ecl-menu__inner-header button.ecl-menu__back .ecl-button__label': "Back" 'li.ecl-menu__item:nth-child(1) a.ecl-menu__link': "Parent 1" - 'li.ecl-menu__item:nth-child(1) a.ecl-menu__link[data-name1="data-value1"]': "Parent 1" + 'li.ecl-menu__item:nth-child(1) a.ecl-menu__link[data-name1="data value1"]': "Parent 1" 'li.ecl-menu__item:nth-child(2) a.ecl-menu__link': "Parent 2" 'li.ecl-menu__item:nth-child(1) ul.ecl-menu__sublist li.ecl-menu__subitem--current a.ecl-menu__sublink.ecl-link--icon-after': 'Child 1.1' - 'li.ecl-menu__item:nth-child(1) ul.ecl-menu__sublist li.ecl-menu__subitem--current a.ecl-menu__sublink.ecl-link--icon-after[data-name2="data-value2"]': 'Child 1.1' + 'li.ecl-menu__item:nth-child(1) ul.ecl-menu__sublist li.ecl-menu__subitem--current a.ecl-menu__sublink.ecl-link--icon-after[data-name2="data value2"]': 'Child 1.1' 'li.ecl-menu__item:nth-child(1) ul.ecl-menu__sublist li.ecl-menu__subitem:nth-child(3) a.ecl-menu__sublink.ecl-link--icon-after': 'Child 1.3' 'li.ecl-menu__item:nth-child(2) ul.ecl-menu__sublist li.ecl-menu__subitem:nth-child(3) a.ecl-menu__sublink.ecl-link--icon-after': 'Child 2.3' equals: