diff --git a/composer.json b/composer.json index 41bb22b98a..8a5af19017 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "drupal/config_readonly": "^1.0", "drupal/core": "~8.9", "drupal/core-composer-scaffold": "~8.9", + "drupal/default_content": "^2.0@alpha", "drupal/diff": "~1.0", "drupal/digital_size_formatter": "~2.0", "drupal/dynamic_entity_reference": "~2.0", diff --git a/composer.lock b/composer.lock index 38b257e5ab..855b079753 100644 --- a/composer.lock +++ b/composer.lock @@ -3222,6 +3222,82 @@ "issues": "https://www.drupal.org/project/issues/ctools" } }, + { + "name": "drupal/default_content", + "version": "2.0.0-alpha1", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/default_content.git", + "reference": "2.0.0-alpha1" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/default_content-2.0.0-alpha1.zip", + "reference": "2.0.0-alpha1", + "shasum": "0d534ab8e44786a352e24c7cec3dc06bef155f66" + }, + "require": { + "drupal/core": "^8.7.7 || ^9" + }, + "require-dev": { + "drupal/paragraphs": "^1" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "2.0.0-alpha1", + "datestamp": "1595072288", + "security-coverage": { + "status": "not-covered", + "message": "Alpha releases are not covered by Drupal security advisories." + } + }, + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Berdir", + "homepage": "https://www.drupal.org/user/214652" + }, + { + "name": "Sam152", + "homepage": "https://www.drupal.org/user/1485048" + }, + { + "name": "andypost", + "homepage": "https://www.drupal.org/user/118908" + }, + { + "name": "benjy", + "homepage": "https://www.drupal.org/user/1852732" + }, + { + "name": "dawehner", + "homepage": "https://www.drupal.org/user/99340" + }, + { + "name": "jibran", + "homepage": "https://www.drupal.org/user/1198144" + }, + { + "name": "larowlan", + "homepage": "https://www.drupal.org/user/395439" + } + ], + "description": "Imports default content when a module is enabled", + "homepage": "https://www.drupal.org/project/default_content", + "support": { + "source": "https://git.drupalcode.org/project/default_content" + } + }, { "name": "drupal/diff", "version": "1.0.0", @@ -20673,6 +20749,7 @@ "stability-flags": { "dkarv/mdl-chip-input": 20, "drupal/config_ignore": 20, + "drupal/default_content": 15, "drupal/menu_link_destination": 20, "drupal/og": 20, "drupal/page_manager": 10, diff --git a/config/sync/block.block.ventuno_footer_menu.yml b/config/sync/block.block.aboutus.yml similarity index 53% rename from config/sync/block.block.ventuno_footer_menu.yml rename to config/sync/block.block.aboutus.yml index 37338a24f1..fdb6ddcc47 100644 --- a/config/sync/block.block.ventuno_footer_menu.yml +++ b/config/sync/block.block.aboutus.yml @@ -1,23 +1,21 @@ -uuid: 1acef884-058e-450c-bc67-505d3a3fd838 +uuid: 8f2ad8e0-8d6f-4885-a094-79f176363562 langcode: en status: true dependencies: config: - - system.menu.footer + - system.menu.footer-about-us module: - system theme: - ventuno -_core: - default_config_hash: IBAuorDvEPLpOEBTV6rOAnCmaW1fezbLLj0dtgQI2G0 -id: ventuno_footer_menu +id: aboutus theme: ventuno region: footer -weight: -16 +weight: -27 provider: null -plugin: 'system_menu_block:footer' +plugin: 'system_menu_block:footer-about-us' settings: - id: 'system_menu_block:footer' + id: 'system_menu_block:footer-about-us' label: 'About us' provider: system label_display: visible diff --git a/config/sync/block.block.europeancommission.yml b/config/sync/block.block.europeancommission.yml new file mode 100644 index 0000000000..2809386c70 --- /dev/null +++ b/config/sync/block.block.europeancommission.yml @@ -0,0 +1,25 @@ +uuid: d516d818-3d5b-4165-9c28-097f3d30a5a4 +langcode: en +status: true +dependencies: + config: + - system.menu.footer-european-commission + module: + - system + theme: + - ventuno +id: europeancommission +theme: ventuno +region: footer +weight: -25 +provider: null +plugin: 'system_menu_block:footer-european-commission' +settings: + id: 'system_menu_block:footer-european-commission' + label: 'European Commission' + provider: system + label_display: visible + level: 1 + depth: 0 + expand_all_items: false +visibility: { } diff --git a/config/sync/block.block.followus.yml b/config/sync/block.block.followus.yml new file mode 100644 index 0000000000..faef3da44d --- /dev/null +++ b/config/sync/block.block.followus.yml @@ -0,0 +1,25 @@ +uuid: 3c616799-451c-4e41-a80f-53005908a1e2 +langcode: en +status: true +dependencies: + config: + - system.menu.footer-follow-us + module: + - system + theme: + - ventuno +id: followus +theme: ventuno +region: footer +weight: -24 +provider: null +plugin: 'system_menu_block:footer-follow-us' +settings: + id: 'system_menu_block:footer-follow-us' + label: 'Follow us' + provider: system + label_display: visible + level: 1 + depth: 0 + expand_all_items: false +visibility: { } diff --git a/config/sync/block.block.help_and_support_footer.yml b/config/sync/block.block.helpandsupport.yml similarity index 56% rename from config/sync/block.block.help_and_support_footer.yml rename to config/sync/block.block.helpandsupport.yml index 2d86b9257c..6b53cd1a79 100644 --- a/config/sync/block.block.help_and_support_footer.yml +++ b/config/sync/block.block.helpandsupport.yml @@ -1,21 +1,21 @@ -uuid: d6b3e8ba-af9b-417a-a18e-861ab66e1292 +uuid: eefc933f-d7e0-4283-940b-0bf08b427977 langcode: en status: true dependencies: config: - - system.menu.support + - system.menu.footer-help-and-support module: - system theme: - ventuno -id: help_and_support_footer +id: helpandsupport theme: ventuno region: footer -weight: 0 +weight: -26 provider: null -plugin: 'system_menu_block:support' +plugin: 'system_menu_block:footer-help-and-support' settings: - id: 'system_menu_block:support' + id: 'system_menu_block:footer-help-and-support' label: 'Help and support' provider: system label_display: visible diff --git a/config/sync/block.block.socialmedia.yml b/config/sync/block.block.socialmedia.yml new file mode 100644 index 0000000000..5a7c5751a2 --- /dev/null +++ b/config/sync/block.block.socialmedia.yml @@ -0,0 +1,25 @@ +uuid: 7202a38b-0b30-4f16-b17e-5adbd97924c1 +langcode: en +status: true +dependencies: + config: + - system.menu.footer-social-media + module: + - system + theme: + - ventuno +id: socialmedia +theme: ventuno +region: footer +weight: -23 +provider: null +plugin: 'system_menu_block:footer-social-media' +settings: + id: 'system_menu_block:footer-social-media' + label: 'Social media' + provider: system + label_display: '0' + level: 1 + depth: 0 + expand_all_items: false +visibility: { } diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 4a61f28912..65f5111853 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -28,6 +28,7 @@ module: dashboard: 0 datetime: 0 datetime_range: 0 + default_content: 0 diff: 0 digital_size_formatter: 0 dpsi: 0 @@ -61,6 +62,7 @@ module: geocoder_field: 0 geocoder_geofield: 0 geofield: 0 + hal: 0 help: 0 honeypot: 0 iframe: 0 @@ -72,6 +74,7 @@ module: joinup_collection: 0 joinup_community_content: 0 joinup_core: 0 + joinup_default_content: 0 joinup_discussion: 0 joinup_document: 0 joinup_eulogin: 0 diff --git a/config/sync/system.menu.footer-about-us.yml b/config/sync/system.menu.footer-about-us.yml new file mode 100644 index 0000000000..b31d160917 --- /dev/null +++ b/config/sync/system.menu.footer-about-us.yml @@ -0,0 +1,8 @@ +uuid: 8a44b579-bf6c-4cf9-b620-f1c4868030cf +langcode: en +status: true +dependencies: { } +id: footer-about-us +label: 'About us' +description: 'Footer: About us' +locked: false diff --git a/config/sync/system.menu.footer-european-commission.yml b/config/sync/system.menu.footer-european-commission.yml new file mode 100644 index 0000000000..317f6ca7a5 --- /dev/null +++ b/config/sync/system.menu.footer-european-commission.yml @@ -0,0 +1,8 @@ +uuid: c2ca3cf8-caf8-4724-941c-0ddf2fa57565 +langcode: en +status: true +dependencies: { } +id: footer-european-commission +label: 'European Commission' +description: 'Footer: European Commission' +locked: false diff --git a/config/sync/system.menu.footer-follow-us.yml b/config/sync/system.menu.footer-follow-us.yml new file mode 100644 index 0000000000..dfc7321ae6 --- /dev/null +++ b/config/sync/system.menu.footer-follow-us.yml @@ -0,0 +1,8 @@ +uuid: da299060-2fac-45b2-8ca1-031627f884dd +langcode: en +status: true +dependencies: { } +id: footer-follow-us +label: 'Follow us' +description: 'Footer: Follow us' +locked: false diff --git a/config/sync/system.menu.footer-help-and-support.yml b/config/sync/system.menu.footer-help-and-support.yml new file mode 100644 index 0000000000..029400db48 --- /dev/null +++ b/config/sync/system.menu.footer-help-and-support.yml @@ -0,0 +1,8 @@ +uuid: e05063d8-6fbb-4fed-82b1-c9b493484249 +langcode: en +status: true +dependencies: { } +id: footer-help-and-support +label: 'Help and support' +description: 'Footer: Help and support' +locked: false diff --git a/config/sync/system.menu.footer-social-media.yml b/config/sync/system.menu.footer-social-media.yml new file mode 100644 index 0000000000..862d032167 --- /dev/null +++ b/config/sync/system.menu.footer-social-media.yml @@ -0,0 +1,8 @@ +uuid: 411499f6-4913-432e-baea-ec0c54443638 +langcode: en +status: true +dependencies: { } +id: footer-social-media +label: 'Social media' +description: 'Footer: Social media' +locked: false diff --git a/config/sync/user.role.moderator.yml b/config/sync/user.role.moderator.yml index c1fbd7b97c..ba3c9ff870 100644 --- a/config/sync/user.role.moderator.yml +++ b/config/sync/user.role.moderator.yml @@ -25,6 +25,11 @@ permissions: - 'administer collection ownership' - 'administer comments' - 'administer entity legal' + - 'administer footer-about-us menu items' + - 'administer footer-european-commission menu items' + - 'administer footer-follow-us menu items' + - 'administer footer-help-and-support menu items' + - 'administer footer-social-media menu items' - 'administer matomo integration' - 'administer nodes' - 'administer organic groups' diff --git a/resources/runner/dev.yml b/resources/runner/dev.yml index 05f4575f42..bf49161ebb 100644 --- a/resources/runner/dev.yml +++ b/resources/runner/dev.yml @@ -10,6 +10,7 @@ dev: - config_devel - config_update - dblog + - joinup_default_content - devel - field_ui - filecache diff --git a/resources/runner/drupal.yml b/resources/runner/drupal.yml index e03fd4d93c..da1e205e17 100644 --- a/resources/runner/drupal.yml +++ b/resources/runner/drupal.yml @@ -169,8 +169,10 @@ drupal: 'config_update', 'config_update_ui', 'dblog', + 'default_content', 'devel', 'filecache', + 'hal', 'joinup_cas_mock_server', 'og_ui', 'page_manager_ui', diff --git a/tests/features/menus/footer_menus.feature b/tests/features/menus/footer_menus.feature new file mode 100644 index 0000000000..9232485e81 --- /dev/null +++ b/tests/features/menus/footer_menus.feature @@ -0,0 +1,39 @@ +@api +Feature: + As a moderator of the website + In order to present proper footer information to the user + I need to be able to manage the footer menus. + + Scenario: A moderator can see the footer menus in the 'Menus' item of the admin toolbar. + Given I am logged in as a moderator + And I am on the homepage + Then I should not see the link "Some random link" in the "Footer" + Then I should see the link "Menus" in the "Administration toolbar" + + When I click "Menus" in the "Administration toolbar" + Then I should see the heading "Menus" + And I should see the following lines of text: + | About us | + | European Commission | + | Follow us | + | Help and support | + | Social media | + | Support | + + When I click "Add link" in the "About us" row + And I fill in "Menu link title" with "Some random link" + And I fill in "Link" with "/collections" + And I press "Save" + Then I should see the success message "The menu link has been saved." + + When I am on the homepage + Then I should see the link "Some random link" in the "Footer" + + When I click "Menus" in the "Administration toolbar" + And I click "List links" in the "About us" row + And I click "Delete" in the "Some random link" row + And I press "Delete" + Then I should see the success message "The menu link Some random link has been deleted." + + When I am on the homepage + Then I should not see the link "Some random link" in the "Footer" diff --git a/tests/features/support/support_menu.feature b/tests/features/menus/support_menu.feature similarity index 89% rename from tests/features/support/support_menu.feature rename to tests/features/menus/support_menu.feature index 8e0c29004e..498e968b06 100644 --- a/tests/features/support/support_menu.feature +++ b/tests/features/menus/support_menu.feature @@ -1,9 +1,7 @@ @api Feature: - - As a moderator, in order to maintain the support dropdown, I am able to - administer the 'support' menu. - - As a user, I should see the the 'Take a tour' menu item only on pages that - are implementing tours. + - As a moderator, in order to maintain the support dropdown, I am able to administer the 'support' menu. + - As a user, I should see the the 'Take a tour' menu item only on pages that are implementing tours. - As a moderator I can add custom menu items and disable default menu items. Scenario Outline: Moderators are not able to admin menus except support menu. @@ -24,13 +22,18 @@ Feature: But I should the link "Add link" Examples: - | menu | code | add link | - | admin | 403 | not see | - | footer | 403 | not see | - | main | 403 | not see | - | support | 200 | see | - | tools | 403 | not see | - | account | 403 | not see | + | menu | code | add link | + | admin | 403 | not see | + | footer | 403 | not see | + | main | 403 | not see | + | support | 200 | see | + | footer-about-us | 200 | see | + | footer-european-commission | 200 | see | + | footer-follow-us | 200 | see | + | footer-help-and-support | 200 | see | + | footer-social-media | 200 | see | + | tools | 403 | not see | + | account | 403 | not see | Scenario Outline: Test user support menu usage. @@ -42,8 +45,8 @@ Feature: When I am on the homepage Then I should not see the link "Guided tour" in the "Footer" - And I should see the link "Contact support" - Then I click "Contact support" + And I should see the link "Contact Joinup Support" + Then I click "Contact Joinup Support" And I fill in the following: | First name | Rufus | | Last name | Modric | diff --git a/tests/features/support/whats_new.feature b/tests/features/menus/whats_new.feature similarity index 100% rename from tests/features/support/whats_new.feature rename to tests/features/menus/whats_new.feature diff --git a/tests/features/site_menus.feature b/tests/features/site_menus.feature index 9117cc366b..58e7a6129d 100644 --- a/tests/features/site_menus.feature +++ b/tests/features/site_menus.feature @@ -27,9 +27,7 @@ Feature: Site menus | Firecrakers list | Check the list first. | Hungry Firecracker | validated | When I am on the homepage - # Todo: This should become "Contact Joinup Support" in the new theme. - # Ref. https://citnet.tech.ec.europa.eu/CITnet/jira/browse/ISAICP-6694 - And I click "Contact support" in the Footer region + And I click "Contact Joinup Support" in the Footer region Then no menu items should be active in the "Header menu" menu # Collections menu item should be active when visiting a collection homepage. diff --git a/web/modules/custom/joinup_core/joinup_core.links.menu.yml b/web/modules/custom/joinup_core/joinup_core.links.menu.yml index 5b68f7b718..a0d5082f76 100644 --- a/web/modules/custom/joinup_core/joinup_core.links.menu.yml +++ b/web/modules/custom/joinup_core/joinup_core.links.menu.yml @@ -14,11 +14,9 @@ joinup_core.redirects: weight: 0 joinup_core.edit_support_menu: - title: 'Support menu' - route_name: entity.menu.edit_form - route_parameters: - menu: support - description: 'Allows to manage the user support menu.' + title: 'Menus' + route_name: entity.menu.collection + description: 'Allows users to manage menus.' parent: system.admin weight: 0 @@ -36,6 +34,13 @@ joinup_core.support.contact: weight: -100 destination: true +joinup_core.support.homepage_contact: + title: 'Contact Joinup Support' + menu_name: footer-help-and-support + url: 'internal:/contact' + weight: -100 + destination: true + joinup_core.manage_media: title: 'Library' route_name: view.media.media_page_list diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/01f49cb4-ac88-469d-bb15-31a08c1beaaf.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/01f49cb4-ac88-469d-bb15-31a08c1beaaf.yml new file mode 100644 index 0000000000..0ee37875e4 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/01f49cb4-ac88-469d-bb15-31a08c1beaaf.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 01f49cb4-ac88-469d-bb15-31a08c1beaaf + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Satisfaction survey' + menu_name: + - + value: footer-help-and-support + link: + - + uri: 'https://ec.europa.eu/eusurvey/runner/Joinup_Satisfaction_Survey' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -47 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/160075bc-f52f-48b3-8049-f9a80ee2dd1a.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/160075bc-f52f-48b3-8049-f9a80ee2dd1a.yml new file mode 100644 index 0000000000..19065c15ec --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/160075bc-f52f-48b3-8049-f9a80ee2dd1a.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 160075bc-f52f-48b3-8049-f9a80ee2dd1a + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Resources for partners' + menu_name: + - + value: footer-european-commission + link: + - + uri: 'https://ec.europa.eu/info/resources-partners_en' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -49 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/1d7ae4fa-8de5-4629-8c22-496c8cfb1368.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/1d7ae4fa-8de5-4629-8c22-496c8cfb1368.yml new file mode 100644 index 0000000000..d356d779fe --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/1d7ae4fa-8de5-4629-8c22-496c8cfb1368.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 1d7ae4fa-8de5-4629-8c22-496c8cfb1368 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Europa Analytics' + menu_name: + - + value: footer-european-commission + link: + - + uri: 'https://ec.europa.eu/info/europa-analytics_en' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -45 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/3b5a3987-33e3-48be-b67b-ea7d745e7aa1.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/3b5a3987-33e3-48be-b67b-ea7d745e7aa1.yml new file mode 100644 index 0000000000..6eb9f3bc87 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/3b5a3987-33e3-48be-b67b-ea7d745e7aa1.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 3b5a3987-33e3-48be-b67b-ea7d745e7aa1 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'About Joinup' + menu_name: + - + value: footer-about-us + link: + - + uri: 'internal:/collection/joinup/about' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: 0 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/3d17368b-533a-4b78-ba16-997d40be6ae5.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/3d17368b-533a-4b78-ba16-997d40be6ae5.yml new file mode 100644 index 0000000000..f5d4127c07 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/3d17368b-533a-4b78-ba16-997d40be6ae5.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 3d17368b-533a-4b78-ba16-997d40be6ae5 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Legal notice' + menu_name: + - + value: footer-european-commission + link: + - + uri: 'internal:/joinup/legal-notice' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -47 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/5cea5e3e-b6e6-44eb-addc-ea2f73fc0eb6.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/5cea5e3e-b6e6-44eb-addc-ea2f73fc0eb6.yml new file mode 100644 index 0000000000..d67d0f9077 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/5cea5e3e-b6e6-44eb-addc-ea2f73fc0eb6.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 5cea5e3e-b6e6-44eb-addc-ea2f73fc0eb6 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: LinkedIn + menu_name: + - + value: footer-social-media + link: + - + uri: 'https://www.linkedin.com/groups/2600644/' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -49 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/5d8efeaf-8655-49e5-850d-0a6cc85052ee.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/5d8efeaf-8655-49e5-850d-0a6cc85052ee.yml new file mode 100644 index 0000000000..f33eceb83b --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/5d8efeaf-8655-49e5-850d-0a6cc85052ee.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 5d8efeaf-8655-49e5-850d-0a6cc85052ee + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: Cookies + menu_name: + - + value: footer-european-commission + link: + - + uri: 'https://ec.europa.eu/info/cookies_en' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -48 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/5fd2bf68-453b-4f11-a680-7aa4e56ef6b4.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/5fd2bf68-453b-4f11-a680-7aa4e56ef6b4.yml new file mode 100644 index 0000000000..398aeff245 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/5fd2bf68-453b-4f11-a680-7aa4e56ef6b4.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 5fd2bf68-453b-4f11-a680-7aa4e56ef6b4 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Joinup newsletter' + menu_name: + - + value: footer-follow-us + link: + - + uri: 'https://ec.europa.eu/newsroom/joinup/newsletter-specific-archive-issue.cfm?newsletter_service_id=877&lang=default' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: 0 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/8c1531f4-3d69-4f9f-b3f0-8f846336c5d8.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/8c1531f4-3d69-4f9f-b3f0-8f846336c5d8.yml new file mode 100644 index 0000000000..bd04ecc113 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/8c1531f4-3d69-4f9f-b3f0-8f846336c5d8.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 8c1531f4-3d69-4f9f-b3f0-8f846336c5d8 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: Twitter + menu_name: + - + value: footer-social-media + link: + - + uri: 'https://twitter.com/joinup_eu' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -50 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/9065069f-cf16-4883-8e26-a1598f6a2c97.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/9065069f-cf16-4883-8e26-a1598f6a2c97.yml new file mode 100644 index 0000000000..1c4cb0dd0a --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/9065069f-cf16-4883-8e26-a1598f6a2c97.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: 9065069f-cf16-4883-8e26-a1598f6a2c97 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'Federation of solutions' + menu_name: + - + value: footer-help-and-support + link: + - + uri: 'internal:/collection/joinup/federation-solutions' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -46 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/b48755b4-8158-4ac4-9f1b-0977ce4fcd13.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/b48755b4-8158-4ac4-9f1b-0977ce4fcd13.yml new file mode 100644 index 0000000000..7903d997b4 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/b48755b4-8158-4ac4-9f1b-0977ce4fcd13.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: b48755b4-8158-4ac4-9f1b-0977ce4fcd13 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: How-to + menu_name: + - + value: footer-help-and-support + link: + - + uri: 'internal:/collection/joinup/how-video-tutorials' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -50 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/d0061f62-3700-4506-bced-c01382bb050a.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/d0061f62-3700-4506-bced-c01382bb050a.yml new file mode 100644 index 0000000000..9e2c62dfab --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/d0061f62-3700-4506-bced-c01382bb050a.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: d0061f62-3700-4506-bced-c01382bb050a + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: Contact + menu_name: + - + value: footer-european-commission + link: + - + uri: 'https://ec.europa.eu/info/contact_en' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -46 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/d20f26d7-2139-4a29-bea9-a4a38b476ca8.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/d20f26d7-2139-4a29-bea9-a4a38b476ca8.yml new file mode 100644 index 0000000000..c49bb7a3ff --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/d20f26d7-2139-4a29-bea9-a4a38b476ca8.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: d20f26d7-2139-4a29-bea9-a4a38b476ca8 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'About the Commission''s new web presence' + menu_name: + - + value: footer-european-commission + link: + - + uri: 'https://ec.europa.eu/info/about-commissions-new-web-presence_en' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: false + weight: + - + value: -50 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/dd34c2cb-c22b-4c74-8c77-20e69b779f21.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/dd34c2cb-c22b-4c74-8c77-20e69b779f21.yml new file mode 100644 index 0000000000..4d755f6b77 --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/dd34c2cb-c22b-4c74-8c77-20e69b779f21.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: dd34c2cb-c22b-4c74-8c77-20e69b779f21 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: 'ADMS-AP Validator' + menu_name: + - + value: footer-help-and-support + link: + - + uri: 'internal:/adms-validator' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -45 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/content/menu_link_content/f00e66fc-6bfc-416b-88c2-24caa2af0708.yml b/web/modules/custom/joinup_default_content/content/menu_link_content/f00e66fc-6bfc-416b-88c2-24caa2af0708.yml new file mode 100644 index 0000000000..c00f82ffcb --- /dev/null +++ b/web/modules/custom/joinup_default_content/content/menu_link_content/f00e66fc-6bfc-416b-88c2-24caa2af0708.yml @@ -0,0 +1,40 @@ +_meta: + version: '1.0' + entity_type: menu_link_content + uuid: f00e66fc-6bfc-416b-88c2-24caa2af0708 + bundle: menu_link_content + default_langcode: en +default: + enabled: + - + value: true + title: + - + value: FAQ + menu_name: + - + value: footer-help-and-support + link: + - + uri: 'internal:/collection/joinup/faq' + title: '' + options: + menu_link_destination: 0 + external: + - + value: false + rediscover: + - + value: true + weight: + - + value: -49 + expanded: + - + value: false + revision_translation_affected: + - + value: true + live_link: + - + value: false diff --git a/web/modules/custom/joinup_default_content/joinup_default_content.info.yml b/web/modules/custom/joinup_default_content/joinup_default_content.info.yml new file mode 100644 index 0000000000..430eafe637 --- /dev/null +++ b/web/modules/custom/joinup_default_content/joinup_default_content.info.yml @@ -0,0 +1,8 @@ +name: Joinup default content +type: module +description: Provides exported content that will be imported in Joinup when the module is enabled. +package: Custom +core_version_requirement: ^8 || ^9 +php: 7.1 +dependencies: + - default_content:default_content diff --git a/web/modules/custom/joinup_tour/joinup_tour.links.menu.yml b/web/modules/custom/joinup_tour/joinup_tour.links.menu.yml index 3f221943f4..a971566831 100644 --- a/web/modules/custom/joinup_tour/joinup_tour.links.menu.yml +++ b/web/modules/custom/joinup_tour/joinup_tour.links.menu.yml @@ -7,3 +7,13 @@ joinup_tour.support.tour: attributes: data-drupal-tour-link: true weight: -200 + +joinup_tour.support.footer-tour: + title: 'Take a tour' + menu_name: footer-help-and-support + url: 'internal:#' + class: Drupal\joinup_tour\Plugin\Menu\TourMenuLink + options: + attributes: + data-drupal-tour-link: true + weight: -200 diff --git a/web/themes/ventuno/src/scss/components/_footer.scss b/web/themes/ventuno/src/scss/components/_footer.scss index 1908243e14..27f1e7cdaa 100644 --- a/web/themes/ventuno/src/scss/components/_footer.scss +++ b/web/themes/ventuno/src/scss/components/_footer.scss @@ -34,6 +34,9 @@ } // Move social network links on mobile to top + .social-media-menu.contextual-region { + position: unset; + } .social-networks { @include media-breakpoint-down(md) { position: absolute; diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer-about-us.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer-about-us.html.twig new file mode 100644 index 0000000000..d9cd5b6a80 --- /dev/null +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer-about-us.html.twig @@ -0,0 +1,47 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'col-md-3', + 'col-lg-2', + 'about-us-menu' + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer-european-commission.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer-european-commission.html.twig new file mode 100644 index 0000000000..aaa21f23a9 --- /dev/null +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer-european-commission.html.twig @@ -0,0 +1,47 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'col-md-3', + 'col-lg-3', + 'european-commission-menu' + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer-follow-us.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer-follow-us.html.twig new file mode 100644 index 0000000000..7d358f4223 --- /dev/null +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer-follow-us.html.twig @@ -0,0 +1,45 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'follow-us-menu' + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer-help-and-support.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer-help-and-support.html.twig new file mode 100644 index 0000000000..09723fef67 --- /dev/null +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer-help-and-support.html.twig @@ -0,0 +1,47 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'col-md-3', + 'col-lg-2', + 'help-and-support-menu' + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer-social-media.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer-social-media.html.twig new file mode 100644 index 0000000000..dcf9894cf0 --- /dev/null +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer-social-media.html.twig @@ -0,0 +1,45 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} +{% + set classes = [ + 'block', + 'block-' ~ configuration.provider|clean_class, + 'block-' ~ plugin_id|clean_class, + 'social-media-menu' + ] +%} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/ventuno/templates/block/block--system-menu-block--footer.html.twig b/web/themes/ventuno/templates/block/block--system-menu-block--footer.html.twig index d9cd5b6a80..71e2ce13db 100644 --- a/web/themes/ventuno/templates/block/block--system-menu-block--footer.html.twig +++ b/web/themes/ventuno/templates/block/block--system-menu-block--footer.html.twig @@ -32,7 +32,7 @@ 'block-' ~ plugin_id|clean_class, 'col-md-3', 'col-lg-2', - 'about-us-menu' + 'footer-menu' ] %} diff --git a/web/themes/ventuno/templates/layout/page--home.html.twig b/web/themes/ventuno/templates/layout/page--home.html.twig index ac5c918946..e53fec601a 100644 --- a/web/themes/ventuno/templates/layout/page--home.html.twig +++ b/web/themes/ventuno/templates/layout/page--home.html.twig @@ -143,38 +143,12 @@

{{ version }}

- {{ page.footer }} - - -
-

{{ 'European Commission'|t }}

- + {{ page.footer|without('followus', 'socialmedia') }} +
+ {{ page.footer.followus }} + {{ page.footer.socialmedia }}
- -
diff --git a/web/themes/ventuno/templates/layout/page.html.twig b/web/themes/ventuno/templates/layout/page.html.twig index 8ec27ee2c6..915b394fc2 100644 --- a/web/themes/ventuno/templates/layout/page.html.twig +++ b/web/themes/ventuno/templates/layout/page.html.twig @@ -42,8 +42,37 @@ #}
+ {# Temporary EC header, until this pattern is included in oe_bootstrap. #} +
+ +
{% if page.header_bottom %} @@ -89,38 +118,12 @@

{{ version }}

- {{ page.footer }} - - -
-

{{ 'European Commission'|t }}

- + {{ page.footer|without('followus', 'socialmedia') }} +
+ {{ page.footer.followus }} + {{ page.footer.socialmedia }}
- -
diff --git a/web/themes/ventuno/templates/menu/menu--region-footer--footer-social-media.html.twig b/web/themes/ventuno/templates/menu/menu--region-footer--footer-social-media.html.twig new file mode 100644 index 0000000000..a661314ab1 --- /dev/null +++ b/web/themes/ventuno/templates/menu/menu--region-footer--footer-social-media.html.twig @@ -0,0 +1,51 @@ +{# +/** + * @file + * Theme override to display the 'support' menu. + * + * Available variables: + * - menu_name: The machine name of the menu. + * - items: A nested list of menu items. Each menu item contains: + * - attributes: HTML attributes for the menu item. + * - below: The menu item child items. + * - title: The menu link title. + * - url: The menu link url, instance of \Drupal\Core\Url + * - localized_options: Menu link localized options. + * - is_expanded: TRUE if the link has visible children within the current + * menu tree. + * - is_collapsed: TRUE if the link has children within the current menu tree + * that are not currently visible. + * - in_active_trail: TRUE if the link is in the active trail. + * + * @ingroup themeable + */ +#} +{% import _self as menus %} + +{# +We call a macro which calls itself to render the full tree. +@see https://twig.symfony.com/doc/1.x/tags/macro.html +#} +{{ menus.menu_links(items, attributes, 0) }} + +{% macro menu_links(items, attributes, menu_level) %} + {% import _self as menus %} + {% if items %} + {% if menu_level == 0 %} + + {% else %} +
    + {% endif %} + {% for item in items %} +
  • + + {{ item.title }} + + {% if item.below %} + {{ menus.menu_links(item.below, attributes, menu_level + 1) }} + {% endif %} +
  • + {% endfor %} +
+ {% endif %} +{% endmacro %} diff --git a/web/themes/ventuno/ventuno.theme b/web/themes/ventuno/ventuno.theme index 4c9496b51e..557dfc8eb9 100644 --- a/web/themes/ventuno/ventuno.theme +++ b/web/themes/ventuno/ventuno.theme @@ -7,6 +7,7 @@ declare(strict_types = 1); +use Drupal\Core\Menu\MenuLinkInterface; use Drupal\Core\Menu\MenuLinkTreeElement; use Drupal\Core\Menu\MenuTreeParameters; use Drupal\Core\Url; @@ -23,8 +24,17 @@ use Drupal\smart_trim\Truncate\TruncateHTML; * styled in the same way. */ function ventuno_theme_suggestions_menu_alter(array &$suggestions, array $variables) { - if (in_array($variables['menu_name'], ['footer', 'support'])) { + if (in_array($variables['menu_name'], [ + 'footer', + 'support', + 'footer-about-us', + 'footer-european-commission', + 'footer-follow-us', + 'footer-help-and-support', + 'footer-social-media', + ])) { $suggestions[] = 'menu__region_footer'; + $suggestions[] = 'menu__region_footer__' . str_replace('-', '_', $variables['menu_name']); } } @@ -206,6 +216,38 @@ function ventuno_preprocess_rdf_entity__explore_item(&$variables) { $variables['label'] = ventuno_smart_trim($entity->label(), 74); } +/** + * Implements template_preprocess_menu(). + */ +function ventuno_preprocess_menu(&$variables) { + // Set a class on each link in the social media footer menu, so that the link + // text can be replaced with an icon. + if ($variables['menu_name'] === 'footer-social-media') { + _ventuno_preprocess_menu_items($variables['items']); + } +} + +/** + * Helper function to recursively set a class on each menu item. + * + * These classes identify the social media links so we can replace them with + * icons. Used for the links to Twitter and LinkedIn. + */ +function _ventuno_preprocess_menu_items(&$items) { + foreach ($items as $item) { + /** @var \Drupal\Core\Menu\MenuLinkDefault $menu_link */ + $menu_link = isset($item['original_link']) ? $item['original_link'] : NULL; + if ($menu_link instanceof MenuLinkInterface) { + $title = strtolower(trim($menu_link->getTitle())); + $machine_name = preg_replace('/[^a-z0-9-]+/', '-', $title); + $item['attributes']->setAttribute('class', $machine_name); + } + if (!empty($item['below'])) { + _ventuno_preprocess_menu_items($item['below']); + } + } +} + /** * Performs smart trimming on the provided string. *