From 3f148c62fd12f9013da6ff5ef6edd1e8179a8628 Mon Sep 17 00:00:00 2001 From: Brian Weaver <weaver.299@osu.edu> Date: Mon, 26 Apr 2021 11:19:27 -0400 Subject: [PATCH] Remove unused simple_megamenu module --- composer.json | 1 - composer.lock | 50 +-- vendor/composer/InstalledVersions.php | 13 +- vendor/composer/installed.json | 54 --- vendor/composer/installed.php | 13 +- web/modules/simple_megamenu/LICENSE.txt | 339 ------------------ web/modules/simple_megamenu/README.txt | 94 ----- web/modules/simple_megamenu/composer.json | 14 - ...ntity_view_mode.simple_mega_menu.after.yml | 10 - ...tity_view_mode.simple_mega_menu.before.yml | 10 - .../schema/simple_mega_menu_type.schema.yml | 18 - web/modules/simple_megamenu/css/style.css | 59 --- .../simple_megamenu/js/simple_megamenu.js | 33 -- web/modules/simple_megamenu/less/style.less | 75 ---- ...play.simple_mega_menu.megamenu.default.yml | 96 ----- ...isplay.simple_mega_menu.megamenu.after.yml | 38 -- ...splay.simple_mega_menu.megamenu.before.yml | 50 --- ...play.simple_mega_menu.megamenu.default.yml | 85 ----- ....simple_mega_menu.megamenu.field_image.yml | 37 -- ...le_mega_menu.megamenu.field_image_link.yml | 22 -- ...e_mega_menu.megamenu.field_image_title.yml | 18 - ....simple_mega_menu.megamenu.field_links.yml | 22 -- ...d.simple_mega_menu.megamenu.field_text.yml | 20 -- ...d.storage.simple_mega_menu.field_image.yml | 29 -- ...rage.simple_mega_menu.field_image_link.yml | 18 - ...age.simple_mega_menu.field_image_title.yml | 20 -- ...d.storage.simple_mega_menu.field_links.yml | 18 - ...ld.storage.simple_mega_menu.field_text.yml | 18 - ...egamenu.simple_mega_menu_type.megamenu.yml | 12 - .../simple_megamenu_example/css/style.css | 14 - .../simple_megamenu_example/less/style.less | 19 - .../simple_megamenu_example.features.yml | 1 - .../simple_megamenu_example.info.yml | 35 -- .../simple_megamenu_example.libraries.yml | 4 - .../simple_megamenu_example.module | 39 -- .../simple-mega-menu--megamenu.html.twig | 50 --- .../simple_megamenu/simple_mega_menu.page.inc | 36 -- .../simple_megamenu/simple_megamenu.info.yml | 10 - .../simple_megamenu.libraries.yml | 9 - .../simple_megamenu.links.action.yml | 11 - .../simple_megamenu.links.menu.yml | 18 - .../simple_megamenu.links.task.yml | 28 -- .../simple_megamenu/simple_megamenu.module | 274 -------------- .../simple_megamenu.permissions.yml | 36 -- .../simple_megamenu.services.yml | 15 - .../Controller/SimpleMegaMenuController.php | 173 --------- .../src/Entity/SimpleMegaMenu.php | 316 ---------------- .../src/Entity/SimpleMegaMenuInterface.php | 122 ------- .../src/Entity/SimpleMegaMenuType.php | 79 ---- .../Entity/SimpleMegaMenuTypeInterface.php | 31 -- .../src/Entity/SimpleMegaMenuViewsData.php | 23 -- ...eMegaMenuAccessCanonicalPageSubscriber.php | 70 ---- .../src/Form/SimpleMegaMenuDeleteForm.php | 15 - .../src/Form/SimpleMegaMenuForm.php | 71 ---- .../Form/SimpleMegaMenuRevisionDeleteForm.php | 123 ------- .../Form/SimpleMegaMenuRevisionRevertForm.php | 149 -------- ...eMegaMenuRevisionRevertTranslationForm.php | 115 ------ .../src/Form/SimpleMegaMenuSettingsForm.php | 55 --- .../src/Form/SimpleMegaMenuTypeDeleteForm.php | 71 ---- .../src/Form/SimpleMegaMenuTypeForm.php | 76 ---- .../SimpleMegaMenuAccessControlHandler.php | 47 --- .../src/SimpleMegaMenuHelper.php | 86 ----- .../src/SimpleMegaMenuHelperInterface.php | 71 ---- .../src/SimpleMegaMenuHtmlRouteProvider.php | 225 ------------ .../src/SimpleMegaMenuListBuilder.php | 116 ------ .../src/SimpleMegaMenuStorage.php | 58 --- .../src/SimpleMegaMenuStorageInterface.php | 61 ---- .../src/SimpleMegaMenuTranslationHandler.php | 13 - .../SimpleMegaMenuTypeHtmlRouteProvider.php | 59 --- .../src/SimpleMegaMenuTypeListBuilder.php | 32 -- .../src/Tests/SimpleMegaMenuTest.php | 251 ------------- .../SimpleMegaMenuTwigExtension.php | 107 ------ .../templates/menu--simple-megamenu.html.twig | 65 ---- ...imple-mega-menu-content-add-list.html.twig | 23 -- .../templates/simple-mega-menu.html.twig | 35 -- 75 files changed, 5 insertions(+), 4618 deletions(-) delete mode 100644 web/modules/simple_megamenu/LICENSE.txt delete mode 100644 web/modules/simple_megamenu/README.txt delete mode 100644 web/modules/simple_megamenu/composer.json delete mode 100644 web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.after.yml delete mode 100644 web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.before.yml delete mode 100644 web/modules/simple_megamenu/config/schema/simple_mega_menu_type.schema.yml delete mode 100644 web/modules/simple_megamenu/css/style.css delete mode 100644 web/modules/simple_megamenu/js/simple_megamenu.js delete mode 100644 web/modules/simple_megamenu/less/style.less delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_form_display.simple_mega_menu.megamenu.default.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.after.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.before.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.default.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_link.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_title.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_links.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_text.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_link.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_title.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_links.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_text.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/simple_megamenu.simple_mega_menu_type.megamenu.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/css/style.css delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/less/style.less delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.features.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.info.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.libraries.yml delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.module delete mode 100644 web/modules/simple_megamenu/modules/simple_megamenu_example/templates/simple-mega-menu--megamenu.html.twig delete mode 100644 web/modules/simple_megamenu/simple_mega_menu.page.inc delete mode 100644 web/modules/simple_megamenu/simple_megamenu.info.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.libraries.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.links.action.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.links.menu.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.links.task.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.module delete mode 100644 web/modules/simple_megamenu/simple_megamenu.permissions.yml delete mode 100644 web/modules/simple_megamenu/simple_megamenu.services.yml delete mode 100644 web/modules/simple_megamenu/src/Controller/SimpleMegaMenuController.php delete mode 100644 web/modules/simple_megamenu/src/Entity/SimpleMegaMenu.php delete mode 100644 web/modules/simple_megamenu/src/Entity/SimpleMegaMenuInterface.php delete mode 100644 web/modules/simple_megamenu/src/Entity/SimpleMegaMenuType.php delete mode 100644 web/modules/simple_megamenu/src/Entity/SimpleMegaMenuTypeInterface.php delete mode 100644 web/modules/simple_megamenu/src/Entity/SimpleMegaMenuViewsData.php delete mode 100644 web/modules/simple_megamenu/src/EventSubscriber/SimpleMegaMenuAccessCanonicalPageSubscriber.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuDeleteForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionDeleteForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertTranslationForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuSettingsForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeDeleteForm.php delete mode 100644 web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeForm.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuAccessControlHandler.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuHelper.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuHelperInterface.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuHtmlRouteProvider.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuListBuilder.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuStorage.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuStorageInterface.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuTranslationHandler.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuTypeHtmlRouteProvider.php delete mode 100644 web/modules/simple_megamenu/src/SimpleMegaMenuTypeListBuilder.php delete mode 100644 web/modules/simple_megamenu/src/Tests/SimpleMegaMenuTest.php delete mode 100644 web/modules/simple_megamenu/src/TwigExtension/SimpleMegaMenuTwigExtension.php delete mode 100644 web/modules/simple_megamenu/templates/menu--simple-megamenu.html.twig delete mode 100644 web/modules/simple_megamenu/templates/simple-mega-menu-content-add-list.html.twig delete mode 100644 web/modules/simple_megamenu/templates/simple-mega-menu.html.twig diff --git a/composer.json b/composer.json index 7d7236e26e..ce90fd506b 100644 --- a/composer.json +++ b/composer.json @@ -166,7 +166,6 @@ "drupal/search_api_db": "1.19", "drupal/simple_gmap": "3.0", "drupal/simple_instagram_feed": "^3.11", - "drupal/simple_megamenu": "1.0-beta3", "drupal/simple_sitemap": "3.10", "drupal/simplesamlphp_auth": "3.2", "drupal/smtp": "1.0", diff --git a/composer.lock b/composer.lock index d541fe7873..a0ee126f09 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "843798e535532282f5f95604c8d1c8db", + "content-hash": "61eb771342ef6b936f27f06d3737cfc5", "packages": [ { "name": "alchemy/zippy", @@ -7878,54 +7878,6 @@ "source": "https://git.drupalcode.org/project/simple_instagram_feed" } }, - { - "name": "drupal/simple_megamenu", - "version": "1.0.0-beta3", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/simple_megamenu.git", - "reference": "8.x-1.0-beta3" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/simple_megamenu-8.x-1.0-beta3.zip", - "reference": "8.x-1.0-beta3", - "shasum": "7acc38f6e9e2fb371f2ea631f45e3110aacb8e4a" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-module", - "extra": { - "drupal": { - "version": "8.x-1.0-beta3", - "datestamp": "1509488285", - "security-coverage": { - "status": "not-covered", - "message": "Beta releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "flocondetoile", - "homepage": "https://www.drupal.org/user/2006064" - } - ], - "description": "Provide a Megamenu entity which can be used on Menu link content to construct a Mega Menu", - "homepage": "https://www.drupal.org/project/simple_megamenu", - "keywords": [ - "Drupal" - ], - "support": { - "source": "http://cgit.drupalcode.org/simple_megamenu", - "issues": "https://www.drupal.org/project/issues/simple_megamenu" - } - }, { "name": "drupal/simple_sitemap", "version": "3.10.0", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index daedd43494..f200e2743e 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -30,7 +30,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => '11ac4bc4a7dc85d65a11da78cbdc0ddccfae171d', + 'reference' => 'fb181bce9c126206eb904564a795200a8dbc2b7e', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -1832,15 +1832,6 @@ class InstalledVersions ), 'reference' => '8.x-3.11', ), - 'drupal/simple_megamenu' => - array ( - 'pretty_version' => '1.0.0-beta3', - 'version' => '1.0.0.0-beta3', - 'aliases' => - array ( - ), - 'reference' => '8.x-1.0-beta3', - ), 'drupal/simple_sitemap' => array ( 'pretty_version' => '3.10.0', @@ -2431,7 +2422,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => '11ac4bc4a7dc85d65a11da78cbdc0ddccfae171d', + 'reference' => 'fb181bce9c126206eb904564a795200a8dbc2b7e', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index a98ae92220..d60ebc776d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -8142,60 +8142,6 @@ }, "install-path": "../../web/modules/simple_instagram_feed" }, - { - "name": "drupal/simple_megamenu", - "version": "1.0.0-beta3", - "version_normalized": "1.0.0.0-beta3", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/simple_megamenu.git", - "reference": "8.x-1.0-beta3" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/simple_megamenu-8.x-1.0-beta3.zip", - "reference": "8.x-1.0-beta3", - "shasum": "7acc38f6e9e2fb371f2ea631f45e3110aacb8e4a" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.0-beta3", - "datestamp": "1509488285", - "security-coverage": { - "status": "not-covered", - "message": "Beta releases are not covered by Drupal security advisories." - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "flocondetoile", - "homepage": "https://www.drupal.org/user/2006064" - } - ], - "description": "Provide a Megamenu entity which can be used on Menu link content to construct a Mega Menu", - "homepage": "https://www.drupal.org/project/simple_megamenu", - "keywords": [ - "Drupal" - ], - "support": { - "source": "http://cgit.drupalcode.org/simple_megamenu", - "issues": "https://www.drupal.org/project/issues/simple_megamenu" - }, - "install-path": "../../web/modules/simple_megamenu" - }, { "name": "drupal/simple_sitemap", "version": "3.10.0", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index db81400749..e2096b3514 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => '11ac4bc4a7dc85d65a11da78cbdc0ddccfae171d', + 'reference' => 'fb181bce9c126206eb904564a795200a8dbc2b7e', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -1808,15 +1808,6 @@ ), 'reference' => '8.x-3.11', ), - 'drupal/simple_megamenu' => - array ( - 'pretty_version' => '1.0.0-beta3', - 'version' => '1.0.0.0-beta3', - 'aliases' => - array ( - ), - 'reference' => '8.x-1.0-beta3', - ), 'drupal/simple_sitemap' => array ( 'pretty_version' => '3.10.0', @@ -2407,7 +2398,7 @@ 'aliases' => array ( ), - 'reference' => '11ac4bc4a7dc85d65a11da78cbdc0ddccfae171d', + 'reference' => 'fb181bce9c126206eb904564a795200a8dbc2b7e', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/web/modules/simple_megamenu/LICENSE.txt b/web/modules/simple_megamenu/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/simple_megamenu/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/web/modules/simple_megamenu/README.txt b/web/modules/simple_megamenu/README.txt deleted file mode 100644 index b811eb170e..0000000000 --- a/web/modules/simple_megamenu/README.txt +++ /dev/null @@ -1,94 +0,0 @@ -CONTENTS OF THIS FILE ---------------------- - - * Introduction - * Requirements - * Recommended modules - * Installation - * Configuration - * Troubleshooting - * FAQ - * Maintainers - -INTRODUCTION ------------- - -Simple MegaMenu module provide a easy way to build mega menu. - -This module provides a new content entity type, Simple MegaMenu. These entities -can be managed as the node entity type : Create bundle, add view mode, add -fields, customize display, etc. For each bundle created, you have to specify -on which menu this bundle will be available. - -You can then reference, from each Menu link content item, any entities -available for this bundle. - -The simple MegaMenu entity attached to an item is then rendered from the Twig -template provided by the module. To achieve this, two new Twig functions are -available : - -* view_megamenu(Url $url, 'view_mode') : this function allows to render the - simple MegaMenu entity attached to an item url, in any view mode needed. -* has_megamenu(Url $url) : this function allows you to check if an item has a - Simple MegaMenu entity attached to it. - -You can then easily customize how your megamenu looks like by overriding the -Twig template in your theme. - -By default, the module provide two view modes for the simple mega menu -entity type : Before and After. - -The default template use theses two view modes. - -You can then easily update your custom template and use any custom view mode -you want, to feet your needs. And you can too render entities attached where -you want. - -Simple MegaMenu entities are translatable and revisionable and play nice with -a mutlilingual site. - -REQUIREMENTS ------------- - -None - -RECOMMENDED MODULES -------------------- - - -INSTALLATION ------------- - - * Install as you would normally install a contributed Drupal module. See: - https://drupal.org/documentation/install/modules-themes/modules-7 - for further information. - -CONFIGURATION -------------- - -* Create a simple mega menu type, as any Content type -* For each simple mega menu type; you have to set on which menu it will be used. -* Configure the simple mega menu type as for a content type : - - add fields - - configure form mode - - configure view mode -* Create som simple mega menu entities -* Edit any Menu link content item form the menu set on the simple mega menu type - created above. Select the simple mega menu entity you want attach to the menu -* Override and customize the menu--simple-megamenu.html.twig template belong - your needs - - -TROUBLESHOOTING ---------------- - - -FAQ ---- - - -MAINTAINERS ------------ - -Current maintainers: - * flocondetoile - https://drupal.org/u/flocondetoile diff --git a/web/modules/simple_megamenu/composer.json b/web/modules/simple_megamenu/composer.json deleted file mode 100644 index 15190eb259..0000000000 --- a/web/modules/simple_megamenu/composer.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "drupal/simple_megamenu", - "type": "drupal-module", - "description": "Provide a Megamenu entity which can be used on Menu link content to construct a Mega Menu", - "keywords": ["Drupal"], - "license": "GPL-2.0+", - "homepage": "https://www.drupal.org/project/simple_megamenu", - "minimum-stability": "dev", - "support": { - "issues": "https://www.drupal.org/project/issues/simple_megamenu", - "source": "http://cgit.drupalcode.org/simple_megamenu" - }, - "require": { } -} diff --git a/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.after.yml b/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.after.yml deleted file mode 100644 index ce73db39c6..0000000000 --- a/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.after.yml +++ /dev/null @@ -1,10 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - simple_megamenu -id: simple_mega_menu.after -label: After -targetEntityType: simple_mega_menu -cache: true diff --git a/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.before.yml b/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.before.yml deleted file mode 100644 index 7628e0b953..0000000000 --- a/web/modules/simple_megamenu/config/install/core.entity_view_mode.simple_mega_menu.before.yml +++ /dev/null @@ -1,10 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - simple_megamenu -id: simple_mega_menu.before -label: Before -targetEntityType: simple_mega_menu -cache: true diff --git a/web/modules/simple_megamenu/config/schema/simple_mega_menu_type.schema.yml b/web/modules/simple_megamenu/config/schema/simple_mega_menu_type.schema.yml deleted file mode 100644 index 9821f26a8e..0000000000 --- a/web/modules/simple_megamenu/config/schema/simple_mega_menu_type.schema.yml +++ /dev/null @@ -1,18 +0,0 @@ -simple_megamenu.simple_mega_menu_type.*: - type: config_entity - label: 'Simple mega menu type config' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - uuid: - type: string - targetMenu: - type: sequence - label: 'Target menus' - sequence: - type: string - label: 'Menu name' diff --git a/web/modules/simple_megamenu/css/style.css b/web/modules/simple_megamenu/css/style.css deleted file mode 100644 index 8d1460b2da..0000000000 --- a/web/modules/simple_megamenu/css/style.css +++ /dev/null @@ -1,59 +0,0 @@ -body { - overflow-x: hidden; -} -.menu--simple-mega-menu { - position: relative; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper { - display: none; - width: 100%; - position: absolute; - top: 100%; - z-index: 9; - left: 0; - background: #fff; - padding: 1rem; - opacity: 0; - transition: opacity 1s ease; - flex-direction: row; - flex-wrap: nowrap; - align-items: flex-start; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-item { - flex: 0 1 auto; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-bottom { - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-items: flex-start; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-bottom .field-item { - flex: 0 1 auto; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper ul.mega-menu-item { - flex-basis: 300px; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-background { - position: absolute; - width: 200vw; - height: 100%; - left: -50vw; - top: 0; - background: #fbfbfb; - z-index: -1; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-item .menu-item { - float: none; -} -.menu--simple-mega-menu > .menu-item--expanded > .mega-menu-wrapper .mega-menu-item .menu-item a { - float: none; - border-radius: 0; -} -.menu--simple-mega-menu > .menu-item--expanded:hover > .mega-menu-wrapper, -.menu--simple-mega-menu > .menu-item--expanded:focus > .mega-menu-wrapper, -.menu--simple-mega-menu > .menu-item--expanded.focused > .mega-menu-wrapper { - opacity: 1; - transition: opacity 1s ease; - display: flex; -} diff --git a/web/modules/simple_megamenu/js/simple_megamenu.js b/web/modules/simple_megamenu/js/simple_megamenu.js deleted file mode 100644 index 87b41e3613..0000000000 --- a/web/modules/simple_megamenu/js/simple_megamenu.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file - * Contains simple_megamenu.js. - */ - -(function ($, Drupal) { - 'use strict'; - - Drupal.behaviors.simple_megamenu = { - attach: function(context, settings) { - - // Basic a11y. - // Make the megamenu navigable with keyboard. - $('ul.menu--simple-mega-menu li.menu-item--expanded a').on('focusin', function(){ - $('li.menu-item--expanded').removeClass('focused'); - $(this).parents('li.menu-item--expanded').addClass('focused'); - }); - - // Close menu on click anywhere. - $('body').on('click', function(){ - $('li.menu-item--expanded').removeClass('focused'); - }); - - // Close menu on escape key press. - $(document).keyup(function(e) { - if (e.keyCode == 27) { - $('li.menu-item--expanded').removeClass('focused'); - } - }); - } - }; - -}(jQuery, Drupal)); diff --git a/web/modules/simple_megamenu/less/style.less b/web/modules/simple_megamenu/less/style.less deleted file mode 100644 index 0822946c69..0000000000 --- a/web/modules/simple_megamenu/less/style.less +++ /dev/null @@ -1,75 +0,0 @@ -body { - overflow-x: hidden; -} -.menu--simple-mega-menu { - position: relative; - - > .menu-item--expanded { - - > .mega-menu-wrapper { - display: none; - width: 100%; - position: absolute; - top: 100%; - z-index: 9; - left: 0; - background: #fff; - padding: 1rem; - opacity: 0; - transition: opacity 1s ease; - flex-direction: row; - flex-wrap: nowrap; - align-items: flex-start; - - .mega-menu-item { - flex: 0 1 auto; - } - - .mega-menu-bottom { - display: flex; - flex-direction: row; - flex-wrap: nowrap; - align-items: flex-start; - .field-item { - flex: 0 1 auto; - } - } - - ul.mega-menu-item { - flex-basis: 300px; - } - - .mega-menu-background { - position: absolute; - width: 200vw; - height: 100%; - left: -50vw; - top: 0; - background: #fbfbfb; - z-index: -1; - - } - - .mega-menu-item { - .menu-item { - float: none; - a { - float: none; - border-radius: 0; - } - } - } - } - - &:hover, - &:focus, - &.focused { - > .mega-menu-wrapper { - opacity: 1; - transition: opacity 1s ease; - display: flex; - } - } - - } -} \ No newline at end of file diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_form_display.simple_mega_menu.megamenu.default.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_form_display.simple_mega_menu.megamenu.default.yml deleted file mode 100644 index ca3985a2f2..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_form_display.simple_mega_menu.megamenu.default.yml +++ /dev/null @@ -1,96 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.simple_mega_menu.megamenu.field_image - - field.field.simple_mega_menu.megamenu.field_image_link - - field.field.simple_mega_menu.megamenu.field_image_title - - field.field.simple_mega_menu.megamenu.field_links - - field.field.simple_mega_menu.megamenu.field_text - - image.style.thumbnail - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - image - - link - - text -id: simple_mega_menu.megamenu.default -targetEntityType: simple_mega_menu -bundle: megamenu -mode: default -content: - field_image: - weight: 1 - settings: - progress_indicator: throbber - preview_image_style: thumbnail - third_party_settings: { } - type: image_image - region: content - field_image_link: - weight: 3 - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - type: link_default - region: content - field_image_title: - weight: 2 - settings: - size: 60 - placeholder: '' - third_party_settings: { } - type: string_textfield - region: content - field_links: - weight: 5 - settings: - placeholder_url: '' - placeholder_title: '' - third_party_settings: { } - type: link_default - region: content - field_text: - weight: 4 - settings: - rows: 5 - placeholder: '' - third_party_settings: { } - type: text_textarea - region: content - langcode: - type: language_select - weight: 10 - region: content - settings: { } - third_party_settings: { } - name: - type: string_textfield - weight: 0 - region: content - settings: - size: 60 - placeholder: '' - third_party_settings: { } - status: - type: boolean_checkbox - settings: - display_label: true - weight: 9 - region: content - third_party_settings: { } - translation: - weight: 8 - region: content - settings: { } - third_party_settings: { } - user_id: - type: entity_reference_autocomplete - weight: 7 - settings: - match_operator: CONTAINS - size: 60 - placeholder: '' - region: content - third_party_settings: { } -hidden: { } diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.after.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.after.yml deleted file mode 100644 index 4f6ab56934..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.after.yml +++ /dev/null @@ -1,38 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.simple_mega_menu.after - - field.field.simple_mega_menu.megamenu.field_image - - field.field.simple_mega_menu.megamenu.field_image_link - - field.field.simple_mega_menu.megamenu.field_image_title - - field.field.simple_mega_menu.megamenu.field_links - - field.field.simple_mega_menu.megamenu.field_text - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - link -id: simple_mega_menu.megamenu.after -targetEntityType: simple_mega_menu -bundle: megamenu -mode: after -content: - field_links: - weight: 0 - label: hidden - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content -hidden: - field_image: true - field_image_link: true - field_image_title: true - field_text: true - langcode: true - name: true - user_id: true diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.before.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.before.yml deleted file mode 100644 index 14702a5bda..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.before.yml +++ /dev/null @@ -1,50 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.simple_mega_menu.before - - field.field.simple_mega_menu.megamenu.field_image - - field.field.simple_mega_menu.megamenu.field_image_link - - field.field.simple_mega_menu.megamenu.field_image_title - - field.field.simple_mega_menu.megamenu.field_links - - field.field.simple_mega_menu.megamenu.field_text - - image.style.large - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - image - - text -id: simple_mega_menu.megamenu.before -targetEntityType: simple_mega_menu -bundle: megamenu -mode: before -content: - field_image: - weight: 0 - label: hidden - settings: - image_style: large - image_link: '' - third_party_settings: { } - type: image - region: content - field_image_title: - type: string - weight: 1 - region: content - label: hidden - settings: - link_to_entity: false - third_party_settings: { } - field_text: - weight: 2 - label: hidden - settings: { } - third_party_settings: { } - type: text_default - region: content -hidden: - field_image_link: true - field_links: true - langcode: true - name: true - user_id: true diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.default.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.default.yml deleted file mode 100644 index a3df77a076..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/core.entity_view_display.simple_mega_menu.megamenu.default.yml +++ /dev/null @@ -1,85 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.field.simple_mega_menu.megamenu.field_image - - field.field.simple_mega_menu.megamenu.field_image_link - - field.field.simple_mega_menu.megamenu.field_image_title - - field.field.simple_mega_menu.megamenu.field_links - - field.field.simple_mega_menu.megamenu.field_text - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - image - - link - - text - - user -id: simple_mega_menu.megamenu.default -targetEntityType: simple_mega_menu -bundle: megamenu -mode: default -content: - field_image: - weight: 1 - label: above - settings: - image_style: '' - image_link: '' - third_party_settings: { } - type: image - region: content - field_image_link: - weight: 6 - label: above - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_image_title: - weight: 5 - label: above - settings: - link_to_entity: false - third_party_settings: { } - type: string - region: content - field_links: - weight: 3 - label: above - settings: - trim_length: 80 - url_only: false - url_plain: false - rel: '' - target: '' - third_party_settings: { } - type: link - region: content - field_text: - weight: 2 - label: above - settings: { } - third_party_settings: { } - type: text_default - region: content - name: - label: above - type: string - weight: -4 - region: content - settings: - link_to_entity: false - third_party_settings: { } - user_id: - label: hidden - type: author - weight: 0 - region: content - settings: { } - third_party_settings: { } -hidden: - langcode: true diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image.yml deleted file mode 100644 index 62ae94b5c0..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image.yml +++ /dev/null @@ -1,37 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.simple_mega_menu.field_image - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - image -id: simple_mega_menu.megamenu.field_image -field_name: field_image -entity_type: simple_mega_menu -bundle: megamenu -label: Image -description: 'The Call to Action image' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - file_directory: '[date:custom:Y]-[date:custom:m]' - file_extensions: 'png gif jpg jpeg' - max_filesize: '' - max_resolution: 400x400 - min_resolution: '' - alt_field: true - alt_field_required: true - title_field: false - title_field_required: false - default_image: - uuid: '' - alt: '' - title: '' - width: null - height: null - handler: 'default:file' - handler_settings: { } -field_type: image diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_link.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_link.yml deleted file mode 100644 index b4e61558e0..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_link.yml +++ /dev/null @@ -1,22 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.simple_mega_menu.field_image_link - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - link -id: simple_mega_menu.megamenu.field_image_link -field_name: field_image_link -entity_type: simple_mega_menu -bundle: megamenu -label: 'Image link' -description: 'The call to action link which wrap the image.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - link_type: 17 - title: 0 -field_type: link diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_title.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_title.yml deleted file mode 100644 index ef8310181a..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_image_title.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.simple_mega_menu.field_image_title - - simple_megamenu.simple_mega_menu_type.megamenu -id: simple_mega_menu.megamenu.field_image_title -field_name: field_image_title -entity_type: simple_mega_menu -bundle: megamenu -label: 'Image title' -description: 'The title displayed on the image.' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: string diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_links.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_links.yml deleted file mode 100644 index d0941ac224..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_links.yml +++ /dev/null @@ -1,22 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.simple_mega_menu.field_links - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - link -id: simple_mega_menu.megamenu.field_links -field_name: field_links -entity_type: simple_mega_menu -bundle: megamenu -label: Links -description: 'The Call to action links' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: - link_type: 17 - title: 2 -field_type: link diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_text.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_text.yml deleted file mode 100644 index 6a97c21900..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.field.simple_mega_menu.megamenu.field_text.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.simple_mega_menu.field_text - - simple_megamenu.simple_mega_menu_type.megamenu - module: - - text -id: simple_mega_menu.megamenu.field_text -field_name: field_text -entity_type: simple_mega_menu -bundle: megamenu -label: Text -description: 'Your teaser text to add with the Call to Action image' -required: false -translatable: false -default_value: { } -default_value_callback: '' -settings: { } -field_type: text_long diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image.yml deleted file mode 100644 index a8872b15f0..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image.yml +++ /dev/null @@ -1,29 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - file - - image - - simple_megamenu -id: simple_mega_menu.field_image -field_name: field_image -entity_type: simple_mega_menu -type: image -settings: - uri_scheme: public - default_image: - uuid: '' - alt: '' - title: '' - width: null - height: null - target_type: file - display_field: false - display_default: false -module: image -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_link.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_link.yml deleted file mode 100644 index 52ec10967d..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_link.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - link - - simple_megamenu -id: simple_mega_menu.field_image_link -field_name: field_image_link -entity_type: simple_mega_menu -type: link -settings: { } -module: link -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_title.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_title.yml deleted file mode 100644 index e2f6b85652..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_image_title.yml +++ /dev/null @@ -1,20 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - simple_megamenu -id: simple_mega_menu.field_image_title -field_name: field_image_title -entity_type: simple_mega_menu -type: string -settings: - max_length: 255 - is_ascii: false - case_sensitive: false -module: core -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_links.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_links.yml deleted file mode 100644 index 16b3321f5d..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_links.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - link - - simple_megamenu -id: simple_mega_menu.field_links -field_name: field_links -entity_type: simple_mega_menu -type: link -settings: { } -module: link -locked: false -cardinality: 6 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_text.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_text.yml deleted file mode 100644 index 05e6875d01..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/field.storage.simple_mega_menu.field_text.yml +++ /dev/null @@ -1,18 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - simple_megamenu - - text -id: simple_mega_menu.field_text -field_name: field_text -entity_type: simple_mega_menu -type: text_long -settings: { } -module: text -locked: false -cardinality: 1 -translatable: true -indexes: { } -persist_with_no_fields: false -custom_storage: false diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/simple_megamenu.simple_mega_menu_type.megamenu.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/simple_megamenu.simple_mega_menu_type.megamenu.yml deleted file mode 100644 index ec88876a3f..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/config/install/simple_megamenu.simple_mega_menu_type.megamenu.yml +++ /dev/null @@ -1,12 +0,0 @@ -langcode: en -status: true -dependencies: { } -id: megamenu -label: MegaMenu -targetMenu: - main: main - admin: '0' - devel: '0' - footer: '0' - tools: '0' - account: '0' diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/css/style.css b/web/modules/simple_megamenu/modules/simple_megamenu_example/css/style.css deleted file mode 100644 index 1edcff4d97..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/css/style.css +++ /dev/null @@ -1,14 +0,0 @@ -.simple-mega-menu .image-wrapper { - position: relative; -} -.simple-mega-menu .image-wrapper .image-title { - position: absolute; - top: 50%; - left: 50%; - text-align: center; - padding: 1rem 2rem; - background-color: rgba(0, 0, 0, 0.6); - transform: translateX(-50%) translateY(-50%); - font-size: 2rem; - color: #fff; -} diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/less/style.less b/web/modules/simple_megamenu/modules/simple_megamenu_example/less/style.less deleted file mode 100644 index 0d1b118190..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/less/style.less +++ /dev/null @@ -1,19 +0,0 @@ -.simple-mega-menu { - .image-wrapper { - position: relative; - - .image-title { - position: absolute; - top: 50%; - left: 50%; - text-align: center; - padding: 1rem 2rem; - background-color: rgba(0, 0, 0, 0.6); - transform: translateX(-50%) translateY(-50%); - font-size: 2rem; - color: #fff; - } - } - - -} diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.features.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.features.yml deleted file mode 100644 index f32a5804e2..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.features.yml +++ /dev/null @@ -1 +0,0 @@ -true \ No newline at end of file diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.info.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.info.yml deleted file mode 100644 index 695441cc49..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.info.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Simple Mega Menu example -type: module -description: Provide a Megamenu entity type as a starting example -# core: 8.x -dependencies: - - simple_megamenu - - file - - image - - link - - text - - user -config_devel: - install: - - core.entity_form_display.simple_mega_menu.megamenu.default - - core.entity_view_display.simple_mega_menu.megamenu.after - - core.entity_view_display.simple_mega_menu.megamenu.before - - core.entity_view_display.simple_mega_menu.megamenu.default - - field.field.simple_mega_menu.megamenu.field_image - - field.field.simple_mega_menu.megamenu.field_links - - field.field.simple_mega_menu.megamenu.field_text - - field.field.simple_mega_menu.megamenu.field_image_link - - field.field.simple_mega_menu.megamenu.field_image_title - - language.content_settings.simple_mega_menu.megamenu - - simple_megamenu.simple_mega_menu_type.megamenu - - field.storage.simple_mega_menu.field_image - - field.storage.simple_mega_menu.field_links - - field.storage.simple_mega_menu.field_text - - field.storage.simple_mega_menu.field_image_link - - field.storage.simple_mega_menu.field_image_title - -# Information added by Drupal.org packaging script on 2017-10-31 -version: '8.x-1.0-beta3' -core: '8.x' -project: 'simple_megamenu' -datestamp: 1509488288 diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.libraries.yml b/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.libraries.yml deleted file mode 100644 index 1e0b62dc1c..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.libraries.yml +++ /dev/null @@ -1,4 +0,0 @@ -base: - css: - component: - css/style.css: {} diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.module b/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.module deleted file mode 100644 index 8d6b5454f6..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/simple_megamenu_example.module +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/** - * @file - * Contains simple_megamenu_example.module. - */ - -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; - -/** - * Implements hook_help(). - */ -function simple_megamenu_example_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - // Main module help for the simple_megamenu module. - case 'help.page.simple_megamenu_example': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('Provide a Megamenu entity type as a starting kit / example.') . '</p>'; - return $output; - - default: - } -} - -/** - * Implements hook_theme(). - */ -function simple_megamenu_example_theme() { - $theme = []; - $theme['simple_mega_menu__megamenu'] = [ - 'render element' => 'elements', - 'base hook' => 'simple_mega_menu', - ]; - return $theme; -} diff --git a/web/modules/simple_megamenu/modules/simple_megamenu_example/templates/simple-mega-menu--megamenu.html.twig b/web/modules/simple_megamenu/modules/simple_megamenu_example/templates/simple-mega-menu--megamenu.html.twig deleted file mode 100644 index 25312ce030..0000000000 --- a/web/modules/simple_megamenu/modules/simple_megamenu_example/templates/simple-mega-menu--megamenu.html.twig +++ /dev/null @@ -1,50 +0,0 @@ -{# -/** - * @file simple_mega_menu.html.twig - * Default theme implementation to present Simple mega menu data. - * - * This template is used when viewing Simple mega menu pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - bundle : the simple mega menu bundle - * - view_mode : the view mode used - * - simple_mega_menu: the simple mega menu entity - * - * @see template_preprocess_simple_mega_menu() - * - * @ingroup themeable - */ -#} - -{% -set classes = [ -'simple-mega-menu', -'mega-menu-item', -'simple-mega-menu-type-' ~ bundle|clean_class, -view_mode ? 'view-mode-' ~ view_mode|clean_class, -] -%} - -{% set image_uri = simple_mega_menu.field_image_link.uri %} -{{ attach_library('simple_megamenu_example/base') }} - -<div{{ attributes.addClass(classes) }}> - {% if content and view_mode == 'before' %} - {% if image_uri %} - <a href="{{ simple_mega_menu.field_image_link.0.url }}"> - {% endif %} - <div class="image-wrapper"> - {{ content | without('field_image_link', 'field_image_title', 'field_text') }} - <div class="image-title">{{ content.field_image_title }}</div> - </div> - {% if image_uri %} - </a> - {% endif %} - <div class="text">{{ content.field_text }}</div> - {% else %} - {{ content }} - {% endif %} -</div> diff --git a/web/modules/simple_megamenu/simple_mega_menu.page.inc b/web/modules/simple_megamenu/simple_mega_menu.page.inc deleted file mode 100644 index d143f886be..0000000000 --- a/web/modules/simple_megamenu/simple_mega_menu.page.inc +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -/** - * @file - * Contains simple_mega_menu.page.inc. - * - * Page callback for Simple mega menu entities. - */ - -use Drupal\Core\Render\Element; - -/** - * Prepares variables for Simple mega menu templates. - * - * Default template: simple_mega_menu.html.twig. - * - * @param array $variables - * An associative array containing: - * - elements: An associative array containing the user information and any - * - attributes: HTML attributes for the containing element. - */ -function template_preprocess_simple_mega_menu(array &$variables) { - // Fetch SimpleMegaMenu Entity Object. - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenu $simple_mega_menu */ - $simple_mega_menu = $variables['elements']['#simple_mega_menu']; - - $variables['view_mode'] = $variables['elements']['#view_mode']; - $variables['bundle'] = $simple_mega_menu->bundle(); - $variables['simple_mega_menu'] = $simple_mega_menu; - - // Helpful $content variable for templates. - foreach (Element::children($variables['elements']) as $key) { - $variables['content'][$key] = $variables['elements'][$key]; - } - -} diff --git a/web/modules/simple_megamenu/simple_megamenu.info.yml b/web/modules/simple_megamenu/simple_megamenu.info.yml deleted file mode 100644 index b0d8fba2d2..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.info.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Simple Mega Menu -type: module -description: Provide a Megamenu entity which can be used on Menu link content to construct a Mega Menu -# core: 8.x - -# Information added by Drupal.org packaging script on 2017-10-31 -version: '8.x-1.0-beta3' -core: '8.x' -project: 'simple_megamenu' -datestamp: 1509488288 diff --git a/web/modules/simple_megamenu/simple_megamenu.libraries.yml b/web/modules/simple_megamenu/simple_megamenu.libraries.yml deleted file mode 100644 index a6a7512def..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.libraries.yml +++ /dev/null @@ -1,9 +0,0 @@ -base: - css: - component: - css/style.css: {} - js: - js/simple_megamenu.js: {} - dependencies: - - core/jquery - - core/drupal diff --git a/web/modules/simple_megamenu/simple_megamenu.links.action.yml b/web/modules/simple_megamenu/simple_megamenu.links.action.yml deleted file mode 100644 index 67f92995f2..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.links.action.yml +++ /dev/null @@ -1,11 +0,0 @@ -entity.simple_mega_menu.add_form: - route_name: 'entity.simple_mega_menu.add_page' - title: 'Add Simple mega menu' - appears_on: - - entity.simple_mega_menu.collection -entity.simple_mega_menu_type.add_form: - route_name: 'entity.simple_mega_menu_type.add_form' - title: 'Add Simple mega menu type' - appears_on: - - entity.simple_mega_menu_type.collection - diff --git a/web/modules/simple_megamenu/simple_megamenu.links.menu.yml b/web/modules/simple_megamenu/simple_megamenu.links.menu.yml deleted file mode 100644 index f52a6e4fdd..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.links.menu.yml +++ /dev/null @@ -1,18 +0,0 @@ - -# Simple mega menu menu items definition -entity.simple_mega_menu.collection: - title: 'Simple mega menu list' - route_name: entity.simple_mega_menu.collection - description: 'List Simple mega menu entities' - parent: system.admin_content - weight: 100 - - -# Simple mega menu type menu items definition -entity.simple_mega_menu_type.collection: - title: 'Simple mega menu type' - route_name: entity.simple_mega_menu_type.collection - description: 'List Simple mega menu type (bundles)' - parent: system.admin_structure - weight: 99 - diff --git a/web/modules/simple_megamenu/simple_megamenu.links.task.yml b/web/modules/simple_megamenu/simple_megamenu.links.task.yml deleted file mode 100644 index cc21591b56..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.links.task.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Simple mega menu routing definition - -entity.simple_mega_menu.canonical: - route_name: entity.simple_mega_menu.canonical - base_route: entity.simple_mega_menu.canonical - title: 'View' - -entity.simple_mega_menu.edit_form: - route_name: entity.simple_mega_menu.edit_form - base_route: entity.simple_mega_menu.canonical - title: 'Edit' - -entity.simple_mega_menu.version_history: - route_name: entity.simple_mega_menu.version_history - base_route: entity.simple_mega_menu.canonical - title: 'Revisions' - -entity.simple_mega_menu.delete_form: - route_name: entity.simple_mega_menu.delete_form - base_route: entity.simple_mega_menu.canonical - title: Delete - weight: 10 - -simple_mega_menu.list_admin: - title: 'Simple mega menu list' - route_name: entity.simple_mega_menu.collection - base_route: system.admin_content - weight: 50 diff --git a/web/modules/simple_megamenu/simple_megamenu.module b/web/modules/simple_megamenu/simple_megamenu.module deleted file mode 100644 index 6c02634cb4..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.module +++ /dev/null @@ -1,274 +0,0 @@ -<?php - -/** - * @file - * Contains simple_megamenu.module. - */ - -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; - -/** - * Implements hook_help(). - */ -function simple_megamenu_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - // Main module help for the simple_megamenu module. - case 'help.page.simple_megamenu': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('Provide a Megamenu entity which can be used on Menu link content to construct a Mega Menu') . '</p>'; - return $output; - - default: - } -} - -/** - * Implements hook_theme(). - */ -function simple_megamenu_theme() { - $theme = []; - $theme['simple_mega_menu'] = [ - 'render element' => 'elements', - 'file' => 'simple_mega_menu.page.inc', - 'template' => 'simple-mega-menu', - ]; - $theme['simple_mega_menu_content_add_list'] = [ - 'render element' => 'content', - 'variables' => ['content' => NULL], - 'file' => 'simple_mega_menu.page.inc', - ]; - $theme['menu__simple_megamenu'] = [ - 'render element' => 'content', - 'base hook' => 'menu', - ]; - return $theme; -} - -/** - * Implements hook_theme_suggestions_HOOK(). - */ -function simple_megamenu_theme_suggestions_simple_mega_menu(array $variables) { - $suggestions = []; - $entity = $variables['elements']['#simple_mega_menu']; - $sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); - - $suggestions[] = 'simple_mega_menu__' . $sanitized_view_mode; - $suggestions[] = 'simple_mega_menu__' . $entity->bundle(); - $suggestions[] = 'simple_mega_menu__' . $entity->bundle() . '__' . $sanitized_view_mode; - $suggestions[] = 'simple_mega_menu__' . $entity->id(); - $suggestions[] = 'simple_mega_menu__' . $entity->id() . '__' . $sanitized_view_mode; - return $suggestions; -} - -/** - * Implements hook_preprocess_HOOK(). - */ -function simple_megamenu_preprocess_block(&$variables) { - // Menus are built with #theme 'menu__MENU_NAME' form the the MenuLinkTree - // class. We need to build menus supported by simple mega menu with the - // default #theme menu, to be able to add suggestions in the good order. - if (isset($variables['content']['#menu_name'])) { - $menu_name = $variables['content']['#menu_name']; - /** @var \Drupal\simple_megamenu\SimpleMegaMenuHelperInterface $simple_megamenu_helper */ - $simple_megamenu_helper = \Drupal::service('simple_megamenu.helper'); - if ($simple_megamenu_helper->menuIsTargetedByMegaMenuType($menu_name)) { - $variables['content']['#theme'] = 'menu'; - } - } -} - -/** - * Implements hook_theme_suggestions_HOOK_alter(). - */ -function simple_megamenu_theme_suggestions_menu_alter(array &$suggestions, array $variables) { - if (!isset($variables['menu_name'])) { - return; - } - $menu_name = $variables['menu_name']; - $menu_name_sanitized = strtr($menu_name, '-', '_'); - - /* @var \Drupal\simple_megamenu\SimpleMegaMenuHelperInterface $simple_megamenu_helper */ - $simple_megamenu_helper = \Drupal::service('simple_megamenu.helper'); - if ($simple_mega_menu_types = $simple_megamenu_helper->getMegaMenuTypeWhichTargetMenu($menu_name)) { - // We add the default suggestion removed in hook_preprocess_block. - $suggestions[] = 'menu__' . $menu_name_sanitized; - // And now our own suggestions. - $suggestions[] = 'menu__simple_megamenu'; - $suggestions[] = 'menu__simple_megamenu__' . $menu_name_sanitized; - - $mega_menu_type_id = implode('_', array_keys($simple_mega_menu_types)); - $suggestions[] = 'menu__simple_megamenu__' . $menu_name_sanitized . '__' . $mega_menu_type_id; - } -} - -/** - * Implements hook_form_BASE_FORM_ID_alter(). - */ -function simple_megamenu_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state, $form_id) { - /* @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */ - $menu_link = $form_state->getFormObject()->getEntity(); - $menu_name = $menu_link->getMenuName(); - $menu_link_options = $menu_link->link->first()->options ?: []; - - /* @var \Drupal\simple_megamenu\SimpleMegaMenuHelperInterface $simple_megamenu_helper */ - $simple_megamenu_helper = \Drupal::service('simple_megamenu.helper'); - $allowed_simple_mega_menu_types = $simple_megamenu_helper->getMegaMenuTypeWhichTargetMenu($menu_name); - $allowed_simple_mega_menu_types = array_keys($allowed_simple_mega_menu_types); - - if ($allowed_simple_mega_menu_types) { - // The default value. - $simple_mega_menu = NULL; - // The default description for the entity reference form. - $description = t('Select a simple mega menu entity to use on this menu link.'); - $simple_mega_menu_id = isset($menu_link_options['attributes']['data-simple-mega-menu']) ? $menu_link_options['attributes']['data-simple-mega-menu'] : NULL; - if ($simple_mega_menu_id) { - $simple_mega_menu = $simple_megamenu_helper->getSimpleMegaMenu($simple_mega_menu_id); - if ($simple_mega_menu instanceof SimpleMegaMenuInterface) { - $destination = \Drupal::destination()->getAsArray(); - $edit_path = Url::fromRoute('entity.simple_mega_menu.edit_form', ['simple_mega_menu' => $simple_mega_menu->id()], ['query' => $destination])->toString(); - $description = t('Select a simple mega menu entity to use on this menu link. Edit the entity referenced <a target="_blank" href="@edit_path">here</a>.', ['@edit_path' => $edit_path]); - } - } - - $form['simple_mega_menu'] = [ - '#title' => t('Simple Mega Menu'), - '#description' => $description, - '#weight' => $form['weight']['#weight'] + 1, - '#type' => 'entity_autocomplete', - '#default_value' => $simple_mega_menu, - '#target_type' => 'simple_mega_menu', - '#selection_handler' => 'default', - '#selection_settings' => [ - 'target_bundles' => $allowed_simple_mega_menu_types, - ], - ]; - - $form['actions']['submit']['#submit'][] = 'simple_megamenu_menu_link_content_form_submit'; - } - -} - -/** - * Submit function for menu add / edit form. - */ -function simple_megamenu_menu_link_content_form_submit($form, FormStateInterface $form_state) { - $menu_link = $form_state->getFormObject()->getEntity(); - $menu_link_options = $menu_link->link->first()->options; - - if ($form_state->getValue('simple_mega_menu')) { - $data_simple_mega_menu = [ - 'attributes' => [ - 'data-simple-mega-menu' => $form_state->getValue('simple_mega_menu'), - ], - ]; - $menu_link->link->first()->options = array_merge_recursive($menu_link_options, $data_simple_mega_menu); - } - - else { - if (isset($menu_link_options['attributes']['data-simple-mega-menu'])) { - unset($menu_link_options['attributes']['data-simple-mega-menu']); - } - $menu_link->link->first()->options = $menu_link_options; - } - - $menu_link->save(); -} - -/** - * Implements hook_form_FORM_ID_alter(). - * - * For routing menu link item added by modules, we need to alter the form - * differently than the menu link content form. The menu link item is here - * a Plugin. - */ -function simple_megamenu_form_menu_link_edit_alter(&$form, FormStateInterface $form_state, $form_id) { - // Currently we can't save options on Menu link plugin because - // \Drupal\Core\Menu\MenuLinkDefault doesn't allow to override options (see - // $overrideAllowed variables). - // And \Drupal\Core\Menu\StaticMenuLinkOverrides::saveOverride too. - // Once https://www.drupal.org/node/2656534 was in, we could save the Plugin - // options definition. - // @see https://www.drupal.org/node/2656534 - return; - - $build_info = $form_state->getBuildInfo(); - - /** @var \Drupal\Core\Menu\MenuLinkDefault $menu_link_default */ - $menu_link_default = $build_info['args'][0]; - $menu_link_options = $menu_link_default->getOptions(); - $menu_name = $menu_link_default->getMenuName(); - - /* @var \Drupal\simple_megamenu\SimpleMegaMenuHelperInterface $simple_megamenu_helper */ - $simple_megamenu_helper = \Drupal::service('simple_megamenu.helper'); - $allowed_simple_mega_menu_types = $simple_megamenu_helper->getMegaMenuTypeWhichTargetMenu($menu_name); - $allowed_simple_mega_menu_types = array_keys($allowed_simple_mega_menu_types); - - if ($allowed_simple_mega_menu_types) { - // The default value. - $simple_mega_menu = NULL; - // The default description for the entity reference form. - $description = t('Select a simple mega menu entity to use on this menu link.'); - $simple_mega_menu_id = isset($menu_link_options['attributes']['data-simple-mega-menu']) ? $menu_link_options['attributes']['data-simple-mega-menu'] : NULL; - if ($simple_mega_menu_id) { - $simple_mega_menu = $simple_megamenu_helper->getSimpleMegaMenu($simple_mega_menu_id); - if ($simple_mega_menu instanceof SimpleMegaMenuInterface) { - $destination = \Drupal::destination()->getAsArray(); - $edit_path = Url::fromRoute('entity.simple_mega_menu.edit_form', ['simple_mega_menu' => $simple_mega_menu->id()], ['query' => $destination])->toString(); - $description = t('Select a simple mega menu entity to use on this menu link. Edit the entity referenced <a target="_blank" href="@edit_path">here</a>.', ['@edit_path' => $edit_path]); - } - } - - $form['simple_mega_menu'] = [ - '#title' => t('Simple Mega Menu'), - '#description' => $description, - '#type' => 'entity_autocomplete', - '#default_value' => $simple_mega_menu, - '#target_type' => 'simple_mega_menu', - '#selection_handler' => 'default', - '#selection_settings' => [ - 'target_bundles' => $allowed_simple_mega_menu_types, - ], - ]; - - $form['#submit'][] = 'simple_megamenu_menu_link_default_form_submit'; - } -} - -/** - * Submit function for menu add / edit form. - */ -function simple_megamenu_menu_link_default_form_submit($form, FormStateInterface $form_state) { - - $build_info = $form_state->getBuildInfo(); - /* @var \Drupal\Core\Menu\MenuLinkDefault $menu_link_default */ - $menu_link_default = $build_info['args'][0]; - - /* @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */ - $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); - $menu_link_options = $menu_link_default->getOptions(); - - if ($form_state->getValue('simple_mega_menu')) { - $data_simple_mega_menu = [ - 'attributes' => [ - 'data-simple-mega-menu' => $form_state->getValue('simple_mega_menu'), - ], - ]; - $options = array_merge($menu_link_options, $data_simple_mega_menu); - $menu_link_manager->updateDefinition($menu_link_default->getPluginId(), ['options' => $options]); - } - - else { - if (isset($menu_link_options['attributes']['data-simple-mega-menu'])) { - unset($menu_link_options['attributes']['data-simple-mega-menu']); - if (empty($menu_link_options['attributes'])) { - unset($menu_link_options['attributes']); - } - } - $menu_link_manager->updateDefinition($menu_link_default->getPluginId(), ['options' => $menu_link_options]); - } - -} diff --git a/web/modules/simple_megamenu/simple_megamenu.permissions.yml b/web/modules/simple_megamenu/simple_megamenu.permissions.yml deleted file mode 100644 index 5ef3d77307..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.permissions.yml +++ /dev/null @@ -1,36 +0,0 @@ -add simple mega menu entities: - title: 'Create new Simple mega menu entities' - -administer simple mega menu entities: - title: 'Administer Simple mega menu entities' - description: 'Allow to access the administration form to configure Simple mega menu entities.' - restrict access: true - -delete simple mega menu entities: - title: 'Delete Simple mega menu entities' - -edit simple mega menu entities: - title: 'Edit Simple mega menu entities' - -access simple mega menu overview: - title: 'Access the Simple mega menu overview page' - -view published simple mega menu entities: - title: 'View published Simple mega menu entities' - -view unpublished simple mega menu entities: - title: 'View unpublished Simple mega menu entities' - -view all simple mega menu revisions: - title: 'View all Simple mega menu revisions' - -revert all simple mega menu revisions: - title: 'Revert all Simple mega menu revisions' - description: 'Role requires permission <em>view Simple mega menu revisions</em> and <em>edit rights</em> for simple mega menu entities in question or <em>administer simple mega menu entities</em>.' - -delete all simple mega menu revisions: - title: 'Delete all revisions' - description: 'Role requires permission to <em>view Simple mega menu revisions</em> and <em>delete rights</em> for simple mega menu entities in question or <em>administer simple mega menu entities</em>.' - -access simple mega menu entities canonical page: - title: 'Access the Simple mega menu entities canonical page' diff --git a/web/modules/simple_megamenu/simple_megamenu.services.yml b/web/modules/simple_megamenu/simple_megamenu.services.yml deleted file mode 100644 index 3140d6592a..0000000000 --- a/web/modules/simple_megamenu/simple_megamenu.services.yml +++ /dev/null @@ -1,15 +0,0 @@ -services: - simple_megamenu.twig.extension: - class: Drupal\simple_megamenu\TwigExtension\SimpleMegaMenuTwigExtension - arguments: ['@entity_type.manager'] - tags: - - { name: twig.extension } - simple_megamenu.helper: - class: Drupal\simple_megamenu\SimpleMegaMenuHelper - arguments: ['@entity_type.manager'] - simple_megamenu.access_canonical_page: - class: Drupal\simple_megamenu\EventSubscriber\SimpleMegaMenuAccessCanonicalPageSubscriber - arguments: ['@current_user', '@url_generator'] - tags: - - { name: event_subscriber } - diff --git a/web/modules/simple_megamenu/src/Controller/SimpleMegaMenuController.php b/web/modules/simple_megamenu/src/Controller/SimpleMegaMenuController.php deleted file mode 100644 index 82a50c26b6..0000000000 --- a/web/modules/simple_megamenu/src/Controller/SimpleMegaMenuController.php +++ /dev/null @@ -1,173 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Controller; - -use Drupal\Component\Utility\Xss; -use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; -use Drupal\Core\Link; - -/** - * Class SimpleMegaMenuController. - * - * Returns responses for Simple mega menu routes. - * - * @package Drupal\simple_megamenu\Controller - */ -class SimpleMegaMenuController extends ControllerBase implements ContainerInjectionInterface { - - /** - * Displays a Simple mega menu revision. - * - * @param int $simple_mega_menu_revision - * The Simple mega menu revision ID. - * - * @return array - * An array suitable for drupal_render(). - */ - public function revisionShow($simple_mega_menu_revision) { - $simple_mega_menu = $this->entityManager()->getStorage('simple_mega_menu')->loadRevision($simple_mega_menu_revision); - $view_builder = $this->entityManager()->getViewBuilder('simple_mega_menu'); - - return $view_builder->view($simple_mega_menu); - } - - /** - * Page title callback for a Simple mega menu revision. - * - * @param int $simple_mega_menu_revision - * The Simple mega menu revision ID. - * - * @return string - * The page title. - */ - public function revisionPageTitle($simple_mega_menu_revision) { - $simple_mega_menu = $this->entityManager()->getStorage('simple_mega_menu')->loadRevision($simple_mega_menu_revision); - return $this->t('Revision of %title from %date', ['%title' => $simple_mega_menu->label(), '%date' => format_date($simple_mega_menu->getRevisionCreationTime())]); - } - - /** - * Generates an overview table of older revisions of a Simple mega menu . - * - * @param \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $simple_mega_menu - * A Simple mega menu object. - * - * @return array - * An array as expected by drupal_render(). - */ - public function revisionOverview(SimpleMegaMenuInterface $simple_mega_menu) { - $account = $this->currentUser(); - $langcode = $simple_mega_menu->language()->getId(); - $langname = $simple_mega_menu->language()->getName(); - $languages = $simple_mega_menu->getTranslationLanguages(); - $has_translations = (count($languages) > 1); - $simple_mega_menu_storage = $this->entityManager()->getStorage('simple_mega_menu'); - - $build['#title'] = $has_translations ? $this->t('@langname revisions for %title', ['@langname' => $langname, '%title' => $simple_mega_menu->label()]) : $this->t('Revisions for %title', ['%title' => $simple_mega_menu->label()]); - $header = [$this->t('Revision'), $this->t('Operations')]; - - $revert_permission = (($account->hasPermission("revert all simple mega menu revisions") || $account->hasPermission('administer simple mega menu entities'))); - $delete_permission = (($account->hasPermission("delete all simple mega menu revisions") || $account->hasPermission('administer simple mega menu entities'))); - - $rows = []; - - $vids = $simple_mega_menu_storage->revisionIds($simple_mega_menu); - - $latest_revision = TRUE; - - foreach (array_reverse($vids) as $vid) { - /** @var \Drupal\simple_megamenu\SimpleMegaMenuInterface $revision */ - $revision = $simple_mega_menu_storage->loadRevision($vid); - // Only show revisions that are affected by the language that is being - // displayed. - if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { - $username = [ - '#theme' => 'username', - '#account' => $revision->getRevisionUser(), - ]; - - // Use revision link to link to revisions that are not active. - $date = \Drupal::service('date.formatter')->format($revision->revision_timestamp->value, 'short'); - if ($vid != $simple_mega_menu->getRevisionId()) { - $link = Link::fromTextAndUrl($date, new Url('entity.simple_mega_menu.revision', ['simple_mega_menu' => $simple_mega_menu->id(), 'simple_mega_menu_revision' => $vid]))->toString(); - } - else { - $link = $simple_mega_menu->link($date); - } - - $row = []; - $column = [ - 'data' => [ - '#type' => 'inline_template', - '#template' => '{% trans %}{{ date }} by {{ username }}{% endtrans %}{% if message %}<p class="revision-log">{{ message }}</p>{% endif %}', - '#context' => [ - 'date' => $link, - 'username' => \Drupal::service('renderer')->renderPlain($username), - 'message' => ['#markup' => $revision->revision_log_message->value, '#allowed_tags' => Xss::getHtmlTagList()], - ], - ], - ]; - $row[] = $column; - - if ($latest_revision) { - $row[] = [ - 'data' => [ - '#prefix' => '<em>', - '#markup' => $this->t('Current revision'), - '#suffix' => '</em>', - ], - ]; - foreach ($row as &$current) { - $current['class'] = ['revision-current']; - } - $latest_revision = FALSE; - } - else { - $links = []; - if ($revert_permission) { - $links['revert'] = [ - 'title' => $this->t('Revert'), - 'url' => $has_translations ? - Url::fromRoute('entity.simple_mega_menu.translation_revert', [ - 'simple_mega_menu' => $simple_mega_menu->id(), - 'simple_mega_menu_revision' => $vid, - 'langcode' => $langcode, - ]) : - Url::fromRoute('entity.simple_mega_menu.revision_revert', [ - 'simple_mega_menu' => $simple_mega_menu->id(), - 'simple_mega_menu_revision' => $vid, - ]), - ]; - } - - if ($delete_permission) { - $links['delete'] = [ - 'title' => $this->t('Delete'), - 'url' => Url::fromRoute('entity.simple_mega_menu.revision_delete', ['simple_mega_menu' => $simple_mega_menu->id(), 'simple_mega_menu_revision' => $vid]), - ]; - } - - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#links' => $links, - ], - ]; - } - - $rows[] = $row; - } - } - - $build['simple_mega_menu_revisions_table'] = [ - '#theme' => 'table', - '#rows' => $rows, - '#header' => $header, - ]; - - return $build; - } - -} diff --git a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenu.php b/web/modules/simple_megamenu/src/Entity/SimpleMegaMenu.php deleted file mode 100644 index 9c04240883..0000000000 --- a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenu.php +++ /dev/null @@ -1,316 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Entity; - -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\Core\Entity\RevisionableContentEntityBase; -use Drupal\Core\Entity\EntityChangedTrait; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\user\UserInterface; - -/** - * Defines the Simple mega menu entity. - * - * @ingroup simple_megamenu - * - * @ContentEntityType( - * id = "simple_mega_menu", - * label = @Translation("Simple mega menu"), - * bundle_label = @Translation("Simple mega menu type"), - * handlers = { - * "storage" = "Drupal\simple_megamenu\SimpleMegaMenuStorage", - * "view_builder" = "Drupal\Core\Entity\EntityViewBuilder", - * "list_builder" = "Drupal\simple_megamenu\SimpleMegaMenuListBuilder", - * "views_data" = "Drupal\simple_megamenu\Entity\SimpleMegaMenuViewsData", - * "translation" = "Drupal\simple_megamenu\SimpleMegaMenuTranslationHandler", - * - * "form" = { - * "default" = "Drupal\simple_megamenu\Form\SimpleMegaMenuForm", - * "add" = "Drupal\simple_megamenu\Form\SimpleMegaMenuForm", - * "edit" = "Drupal\simple_megamenu\Form\SimpleMegaMenuForm", - * "delete" = "Drupal\simple_megamenu\Form\SimpleMegaMenuDeleteForm", - * }, - * "access" = "Drupal\simple_megamenu\SimpleMegaMenuAccessControlHandler", - * "route_provider" = { - * "html" = "Drupal\simple_megamenu\SimpleMegaMenuHtmlRouteProvider", - * }, - * }, - * base_table = "simple_mega_menu", - * data_table = "simple_mega_menu_field_data", - * revision_table = "simple_mega_menu_revision", - * revision_data_table = "simple_mega_menu_field_revision", - * translatable = TRUE, - * admin_permission = "administer simple mega menu entities", - * entity_keys = { - * "id" = "id", - * "revision" = "vid", - * "bundle" = "type", - * "label" = "name", - * "uuid" = "uuid", - * "uid" = "user_id", - * "langcode" = "langcode", - * "status" = "status", - * }, - * links = { - * "canonical" = "/admin/content/simple_mega_menu/{simple_mega_menu}", - * "add-page" = "/admin/content/simple_mega_menu/add", - * "add-form" = "/admin/content/simple_mega_menu/add/{simple_mega_menu_type}", - * "edit-form" = "/admin/content/simple_mega_menu/{simple_mega_menu}/edit", - * "delete-form" = "/admin/content/simple_mega_menu/{simple_mega_menu}/delete", - * "version-history" = "/admin/content/simple_mega_menu/{simple_mega_menu}/revisions", - * "revision" = "/admin/content/simple_mega_menu/{simple_mega_menu}/revisions/{simple_mega_menu_revision}/view", - * "collection" = "/admin/content/simple_mega_menu", - * }, - * bundle_entity_type = "simple_mega_menu_type", - * field_ui_base_route = "entity.simple_mega_menu_type.edit_form" - * ) - */ -class SimpleMegaMenu extends RevisionableContentEntityBase implements SimpleMegaMenuInterface { - - use EntityChangedTrait; - - /** - * {@inheritdoc} - */ - public static function preCreate(EntityStorageInterface $storage_controller, array &$values) { - parent::preCreate($storage_controller, $values); - $values += [ - 'user_id' => \Drupal::currentUser()->id(), - ]; - } - - /** - * {@inheritdoc} - */ - public function preSave(EntityStorageInterface $storage) { - parent::preSave($storage); - - foreach (array_keys($this->getTranslationLanguages()) as $langcode) { - $translation = $this->getTranslation($langcode); - - // If no owner has been set explicitly, make the anonymous user the owner. - if (!$translation->getOwner()) { - $translation->setOwnerId(0); - } - } - - // If no revision author has been set explicitly, make the simple_mega_menu - // owner the revision author. - if (!$this->getRevisionUser()) { - $this->setRevisionUserId($this->getOwnerId()); - } - } - - /** - * {@inheritdoc} - */ - public function getType() { - return $this->bundle(); - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name')->value; - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getCreatedTime() { - return $this->get('created')->value; - } - - /** - * {@inheritdoc} - */ - public function setCreatedTime($timestamp) { - $this->set('created', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOwner() { - return $this->get('user_id')->entity; - } - - /** - * {@inheritdoc} - */ - public function getOwnerId() { - return $this->get('user_id')->target_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerId($uid) { - $this->set('user_id', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public function setOwner(UserInterface $account) { - $this->set('user_id', $account->id()); - return $this; - } - - /** - * {@inheritdoc} - */ - public function isPublished() { - return (bool) $this->getEntityKey('status'); - } - - /** - * {@inheritdoc} - */ - public function setPublished($published) { - $this->set('status', $published ? TRUE : FALSE); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getRevisionCreationTime() { - return $this->get('revision_timestamp')->value; - } - - /** - * {@inheritdoc} - */ - public function setRevisionCreationTime($timestamp) { - $this->set('revision_timestamp', $timestamp); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getRevisionUser() { - return $this->get('revision_uid')->entity; - } - - /** - * {@inheritdoc} - */ - public function setRevisionUserId($uid) { - $this->set('revision_uid', $uid); - return $this; - } - - /** - * {@inheritdoc} - */ - public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { - $fields = parent::baseFieldDefinitions($entity_type); - - $fields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Authored by')) - ->setDescription(t('The user ID of author of the Simple mega menu entity.')) - ->setRevisionable(TRUE) - ->setSetting('target_type', 'user') - ->setSetting('handler', 'default') - ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ - 'label' => 'hidden', - 'type' => 'author', - 'weight' => 0, - ]) - ->setDisplayOptions('form', [ - 'type' => 'entity_reference_autocomplete', - 'weight' => 5, - 'settings' => [ - 'match_operator' => 'CONTAINS', - 'size' => '60', - 'autocomplete_type' => 'tags', - 'placeholder' => '', - ], - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); - - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the Simple mega menu entity.')) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE) - ->setSettings([ - 'max_length' => 50, - 'text_processing' => 0, - ]) - ->setDefaultValue('') - ->setDisplayOptions('view', [ - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - ]) - ->setDisplayOptions('form', [ - 'type' => 'string_textfield', - 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); - - $fields['status'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Publishing status')) - ->setDescription(t('A boolean indicating whether the Simple mega menu is published.')) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE) - ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'boolean_checkbox', - 'settings' => [ - 'display_label' => TRUE, - ], - 'weight' => 120, - ]) - ->setDisplayConfigurable('form', TRUE); - - $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Created')) - ->setDescription(t('The time that the entity was created.')); - - $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel(t('Changed')) - ->setDescription(t('The time that the entity was last edited.')); - - $fields['revision_timestamp'] = BaseFieldDefinition::create('created') - ->setLabel(t('Revision timestamp')) - ->setDescription(t('The time that the current revision was created.')) - ->setQueryable(FALSE) - ->setRevisionable(TRUE); - - $fields['revision_uid'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Revision user ID')) - ->setDescription(t('The user ID of the author of the current revision.')) - ->setSetting('target_type', 'user') - ->setQueryable(FALSE) - ->setRevisionable(TRUE); - - $fields['revision_translation_affected'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Revision translation affected')) - ->setDescription(t('Indicates if the last edit of a translation belongs to current revision.')) - ->setReadOnly(TRUE) - ->setRevisionable(TRUE) - ->setTranslatable(TRUE); - - return $fields; - } - -} diff --git a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuInterface.php b/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuInterface.php deleted file mode 100644 index 3a992dbfb3..0000000000 --- a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuInterface.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Entity; - -use Drupal\Core\Entity\RevisionLogInterface; -use Drupal\Core\Entity\RevisionableInterface; -use Drupal\Core\Entity\EntityChangedInterface; -use Drupal\user\EntityOwnerInterface; - -/** - * Provides an interface for defining Simple mega menu entities. - * - * @ingroup simple_megamenu - */ -interface SimpleMegaMenuInterface extends RevisionableInterface, RevisionLogInterface, EntityChangedInterface, EntityOwnerInterface { - - /** - * Gets the Simple mega menu type. - * - * @return string - * The Simple mega menu type. - */ - public function getType(); - - /** - * Gets the Simple mega menu name. - * - * @return string - * Name of the Simple mega menu. - */ - public function getName(); - - /** - * Sets the Simple mega menu name. - * - * @param string $name - * The Simple mega menu name. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The called Simple mega menu entity. - */ - public function setName($name); - - /** - * Gets the Simple mega menu creation timestamp. - * - * @return int - * Creation timestamp of the Simple mega menu. - */ - public function getCreatedTime(); - - /** - * Sets the Simple mega menu creation timestamp. - * - * @param int $timestamp - * The Simple mega menu creation timestamp. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The called Simple mega menu entity. - */ - public function setCreatedTime($timestamp); - - /** - * Returns the Simple mega menu published status indicator. - * - * Unpublished Simple mega menu are only visible to restricted users. - * - * @return bool - * TRUE if the Simple mega menu is published. - */ - public function isPublished(); - - /** - * Sets the published status of a Simple mega menu. - * - * @param bool $published - * TRUE to set this entity to published, FALSE to set it to unpublished. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The called Simple mega menu entity. - */ - public function setPublished($published); - - /** - * Gets the Simple mega menu revision creation timestamp. - * - * @return int - * The UNIX timestamp of when this revision was created. - */ - public function getRevisionCreationTime(); - - /** - * Sets the Simple mega menu revision creation timestamp. - * - * @param int $timestamp - * The UNIX timestamp of when this revision was created. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The called Simple mega menu entity. - */ - public function setRevisionCreationTime($timestamp); - - /** - * Gets the Simple mega menu revision author. - * - * @return \Drupal\user\UserInterface - * The user entity for the revision author. - */ - public function getRevisionUser(); - - /** - * Sets the Simple mega menu revision author. - * - * @param int $uid - * The user ID of the revision author. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The called Simple mega menu entity. - */ - public function setRevisionUserId($uid); - -} diff --git a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuType.php b/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuType.php deleted file mode 100644 index 1179f6442f..0000000000 --- a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuType.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Entity; - -use Drupal\Core\Config\Entity\ConfigEntityBundleBase; - -/** - * Defines the Simple mega menu type entity. - * - * @ConfigEntityType( - * id = "simple_mega_menu_type", - * label = @Translation("Simple mega menu type"), - * handlers = { - * "list_builder" = "Drupal\simple_megamenu\SimpleMegaMenuTypeListBuilder", - * "form" = { - * "add" = "Drupal\simple_megamenu\Form\SimpleMegaMenuTypeForm", - * "edit" = "Drupal\simple_megamenu\Form\SimpleMegaMenuTypeForm", - * "delete" = "Drupal\simple_megamenu\Form\SimpleMegaMenuTypeDeleteForm" - * }, - * "route_provider" = { - * "html" = "Drupal\simple_megamenu\SimpleMegaMenuTypeHtmlRouteProvider", - * }, - * }, - * config_prefix = "simple_mega_menu_type", - * admin_permission = "administer site configuration", - * bundle_of = "simple_mega_menu", - * entity_keys = { - * "id" = "id", - * "label" = "label", - * "uuid" = "uuid" - * }, - * links = { - * "canonical" = "/admin/structure/simple_mega_menu_type/{simple_mega_menu_type}", - * "add-form" = "/admin/structure/simple_mega_menu_type/add", - * "edit-form" = "/admin/structure/simple_mega_menu_type/{simple_mega_menu_type}/edit", - * "delete-form" = "/admin/structure/simple_mega_menu_type/{simple_mega_menu_type}/delete", - * "collection" = "/admin/structure/simple_mega_menu_type" - * } - * ) - */ -class SimpleMegaMenuType extends ConfigEntityBundleBase implements SimpleMegaMenuTypeInterface { - - /** - * The Simple mega menu type ID. - * - * @var string - */ - protected $id; - - /** - * The Simple mega menu type label. - * - * @var string - */ - protected $label; - - /** - * The target menus this mega menu type is used for. - * - * @var array - */ - protected $targetMenu = []; - - /** - * {@inheritdoc} - */ - public function getTargetMenu() { - return $this->targetMenu; - } - - /** - * {@inheritdoc} - */ - public function setTargetMenu($target_menu) { - $this->targetMenu = $target_menu; - return $this; - } - -} diff --git a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuTypeInterface.php b/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuTypeInterface.php deleted file mode 100644 index 1b0292f941..0000000000 --- a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuTypeInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Entity; - -use Drupal\Core\Config\Entity\ConfigEntityInterface; - -/** - * Provides an interface for defining Simple mega menu type entities. - */ -interface SimpleMegaMenuTypeInterface extends ConfigEntityInterface { - - /** - * Gets the target menu. - * - * @return array - * The menus targeted by the entity. - */ - public function getTargetMenu(); - - /** - * Sets the target menus. - * - * @param array $target_menu - * The target menus. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface - * The SimpleMegaMenuType. - */ - public function setTargetMenu($target_menu); - -} diff --git a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuViewsData.php b/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuViewsData.php deleted file mode 100644 index edf183a629..0000000000 --- a/web/modules/simple_megamenu/src/Entity/SimpleMegaMenuViewsData.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Entity; - -use Drupal\views\EntityViewsData; - -/** - * Provides Views data for Simple mega menu entities. - */ -class SimpleMegaMenuViewsData extends EntityViewsData { - - /** - * {@inheritdoc} - */ - public function getViewsData() { - $data = parent::getViewsData(); - - // Additional information for Views integration, such as table joins, can be - // put here. - return $data; - } - -} diff --git a/web/modules/simple_megamenu/src/EventSubscriber/SimpleMegaMenuAccessCanonicalPageSubscriber.php b/web/modules/simple_megamenu/src/EventSubscriber/SimpleMegaMenuAccessCanonicalPageSubscriber.php deleted file mode 100644 index 7e366ec9ff..0000000000 --- a/web/modules/simple_megamenu/src/EventSubscriber/SimpleMegaMenuAccessCanonicalPageSubscriber.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\EventSubscriber; - -use Drupal\Core\Session\AccountInterface; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Drupal\Core\Routing\UrlGeneratorInterface; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; - -/** - * Class SimpleMegaMenuAccessCanonicalPageSubscriber. - * - * @package Drupal\simple_megamenu - */ -class SimpleMegaMenuAccessCanonicalPageSubscriber implements EventSubscriberInterface { - - /** - * The current user. - * - * @var \Drupal\Core\Session\AccountInterface - */ - protected $currentUser; - - /** - * Constructor. - * - * @param \Drupal\Core\Session\AccountInterface $current_user - * The current user. - * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The url generator. - */ - public function __construct(AccountInterface $current_user, UrlGeneratorInterface $url_generator) { - $this->currentUser = $current_user; - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events[KernelEvents::REQUEST] = ['onRequestCheckAccess']; - return $events; - } - - /** - * This method is called whenever the kernel.request event is dispatched. - * - * @param GetResponseEvent $event - * The event object. - */ - public function onRequestCheckAccess(GetResponseEvent $event) { - $request = $event->getRequest(); - - // If we've got an exception, nothing to do here. - if ($request->get('exception') != NULL) { - return; - } - - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenu $simple_mega_menu */ - $simple_mega_menu = $request->get('simple_mega_menu'); - if ($simple_mega_menu && $simple_mega_menu instanceof SimpleMegaMenuInterface) { - if (!$this->currentUser->hasPermission('access simple mega menu entities canonical page')) { - throw new NotFoundHttpException(); - } - } - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuDeleteForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuDeleteForm.php deleted file mode 100644 index b54d879c2d..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuDeleteForm.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Entity\ContentEntityDeleteForm; - -/** - * Provides a form for deleting Simple mega menu entities. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuDeleteForm extends ContentEntityDeleteForm { - - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuForm.php deleted file mode 100644 index 1516d2d724..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuForm.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Entity\ContentEntityForm; -use Drupal\Core\Form\FormStateInterface; - -/** - * Form controller for Simple mega menu edit forms. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuForm extends ContentEntityForm { - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - /* @var $entity \Drupal\simple_megamenu\Entity\SimpleMegaMenu */ - $form = parent::buildForm($form, $form_state); - - if (!$this->entity->isNew()) { - $form['new_revision'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Create new revision'), - '#default_value' => FALSE, - '#weight' => 10, - ]; - } - - $entity = $this->entity; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $entity = &$this->entity; - - // Save as a new revision if requested to do so. - if (!$form_state->isValueEmpty('new_revision') && $form_state->getValue('new_revision') != FALSE) { - $entity->setNewRevision(); - - // If a new revision is created, save the current user as revision author. - $entity->setRevisionCreationTime(REQUEST_TIME); - $entity->setRevisionUserId(\Drupal::currentUser()->id()); - } - else { - $entity->setNewRevision(FALSE); - } - - $status = parent::save($form, $form_state); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Simple mega menu.', [ - '%label' => $entity->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Simple mega menu.', [ - '%label' => $entity->label(), - ])); - } - $form_state->setRedirect('entity.simple_mega_menu.canonical', ['simple_mega_menu' => $entity->id()]); - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionDeleteForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionDeleteForm.php deleted file mode 100644 index 93c2b88d1f..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionDeleteForm.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Database\Connection; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Form\ConfirmFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a form for deleting a Simple mega menu revision. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuRevisionDeleteForm extends ConfirmFormBase { - - - /** - * The Simple mega menu revision. - * - * @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - */ - protected $revision; - - /** - * The Simple mega menu storage. - * - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - protected $SimpleMegaMenuStorage; - - /** - * The database connection. - * - * @var \Drupal\Core\Database\Connection - */ - protected $connection; - - /** - * Constructs a new SimpleMegaMenuRevisionDeleteForm. - * - * @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage - * The entity storage. - * @param \Drupal\Core\Database\Connection $connection - * The database connection. - */ - public function __construct(EntityStorageInterface $entity_storage, Connection $connection) { - $this->SimpleMegaMenuStorage = $entity_storage; - $this->connection = $connection; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - $entity_manager = $container->get('entity.manager'); - return new static( - $entity_manager->getStorage('simple_mega_menu'), - $container->get('database') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'simple_mega_menu_revision_delete_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to delete the revision from %revision-date?', ['%revision-date' => format_date($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.simple_mega_menu.version_history', ['simple_mega_menu' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $simple_mega_menu_revision = NULL) { - $this->revision = $this->SimpleMegaMenuStorage->loadRevision($simple_mega_menu_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->SimpleMegaMenuStorage->deleteRevision($this->revision->getRevisionId()); - - $this->logger('content')->notice('Simple mega menu: deleted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Revision from %revision-date of Simple mega menu %title has been deleted.', ['%revision-date' => format_date($this->revision->getRevisionCreationTime()), '%title' => $this->revision->label()])); - $form_state->setRedirect( - 'entity.simple_mega_menu.canonical', - ['simple_mega_menu' => $this->revision->id()] - ); - if ($this->connection->query('SELECT COUNT(DISTINCT vid) FROM {simple_mega_menu_field_revision} WHERE id = :id', [':id' => $this->revision->id()])->fetchField() > 1) { - $form_state->setRedirect( - 'entity.simple_mega_menu.version_history', - ['simple_mega_menu' => $this->revision->id()] - ); - } - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertForm.php deleted file mode 100644 index 5e311982b6..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertForm.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Form\ConfirmFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a form for reverting a Simple mega menu revision. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuRevisionRevertForm extends ConfirmFormBase { - - - /** - * The Simple mega menu revision. - * - * @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - */ - protected $revision; - - /** - * The Simple mega menu storage. - * - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - protected $SimpleMegaMenuStorage; - - /** - * The date formatter service. - * - * @var \Drupal\Core\Datetime\DateFormatterInterface - */ - protected $dateFormatter; - - /** - * Constructs a new SimpleMegaMenuRevisionRevertForm. - * - * @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage - * The Simple mega menu storage. - * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter - * The date formatter service. - */ - public function __construct(EntityStorageInterface $entity_storage, DateFormatterInterface $date_formatter) { - $this->SimpleMegaMenuStorage = $entity_storage; - $this->dateFormatter = $date_formatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('simple_mega_menu'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'simple_mega_menu_revision_revert_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert to the revision from %revision-date?', ['%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.simple_mega_menu.version_history', ['simple_mega_menu' => $this->revision->id()]); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Revert'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return ''; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $simple_mega_menu_revision = NULL) { - $this->revision = $this->SimpleMegaMenuStorage->loadRevision($simple_mega_menu_revision); - $form = parent::buildForm($form, $form_state); - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // The revision timestamp will be updated when the revision is saved. Keep - // the original one for the confirmation message. - $original_revision_timestamp = $this->revision->getRevisionCreationTime(); - - $this->revision = $this->prepareRevertedRevision($this->revision, $form_state); - $this->revision->revision_log = t('Copy of the revision from %date.', ['%date' => $this->dateFormatter->format($original_revision_timestamp)]); - $this->revision->save(); - - $this->logger('content')->notice('Simple mega menu: reverted %title revision %revision.', ['%title' => $this->revision->label(), '%revision' => $this->revision->getRevisionId()]); - drupal_set_message(t('Simple mega menu %title has been reverted to the revision from %revision-date.', ['%title' => $this->revision->label(), '%revision-date' => $this->dateFormatter->format($original_revision_timestamp)])); - $form_state->setRedirect( - 'entity.simple_mega_menu.version_history', - ['simple_mega_menu' => $this->revision->id()] - ); - } - - /** - * Prepares a revision to be reverted. - * - * @param \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $revision - * The revision to be reverted. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The prepared revision ready to be stored. - */ - protected function prepareRevertedRevision(SimpleMegaMenuInterface $revision, FormStateInterface $form_state) { - $revision->setNewRevision(); - $revision->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $revision; - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertTranslationForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertTranslationForm.php deleted file mode 100644 index 9eb43672cb..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuRevisionRevertTranslationForm.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Language\LanguageManagerInterface; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a form for reverting a megamenu revision for a single translation. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuRevisionRevertTranslationForm extends SimpleMegaMenuRevisionRevertForm { - - - /** - * The language to be reverted. - * - * @var string - */ - protected $langcode; - - /** - * The language manager. - * - * @var \Drupal\Core\Language\LanguageManagerInterface - */ - protected $languageManager; - - /** - * Constructs a new SimpleMegaMenuRevisionRevertTranslationForm. - * - * @param \Drupal\Core\Entity\EntityStorageInterface $entity_storage - * The Simple mega menu storage. - * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter - * The date formatter service. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. - */ - public function __construct(EntityStorageInterface $entity_storage, DateFormatterInterface $date_formatter, LanguageManagerInterface $language_manager) { - parent::__construct($entity_storage, $date_formatter); - $this->languageManager = $language_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity.manager')->getStorage('simple_mega_menu'), - $container->get('date.formatter'), - $container->get('language_manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'simple_mega_menu_revision_revert_translation_confirm'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to revert @language translation to the revision from %revision-date?', ['@language' => $this->languageManager->getLanguageName($this->langcode), '%revision-date' => $this->dateFormatter->format($this->revision->getRevisionCreationTime())]); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $simple_mega_menu_revision = NULL, $langcode = NULL) { - $this->langcode = $langcode; - $form = parent::buildForm($form, $form_state, $simple_mega_menu_revision); - - $form['revert_untranslated_fields'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Revert content shared among translations'), - '#default_value' => FALSE, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - protected function prepareRevertedRevision(SimpleMegaMenuInterface $revision, FormStateInterface $form_state) { - $revert_untranslated_fields = $form_state->getValue('revert_untranslated_fields'); - - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $default_revision */ - $latest_revision = $this->SimpleMegaMenuStorage->load($revision->id()); - $latest_revision_translation = $latest_revision->getTranslation($this->langcode); - - $revision_translation = $revision->getTranslation($this->langcode); - - foreach ($latest_revision_translation->getFieldDefinitions() as $field_name => $definition) { - if ($definition->isTranslatable() || $revert_untranslated_fields) { - $latest_revision_translation->set($field_name, $revision_translation->get($field_name)->getValue()); - } - } - - $latest_revision_translation->setNewRevision(); - $latest_revision_translation->isDefaultRevision(TRUE); - $revision->setRevisionCreationTime(REQUEST_TIME); - - return $latest_revision_translation; - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuSettingsForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuSettingsForm.php deleted file mode 100644 index 13b5b221db..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuSettingsForm.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; - -/** - * Class SimpleMegaMenuSettingsForm. - * - * @package Drupal\simple_megamenu\Form - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuSettingsForm extends FormBase { - - /** - * Returns a unique string identifying the form. - * - * @return string - * The unique string identifying the form. - */ - public function getFormId() { - return 'SimpleMegaMenu_settings'; - } - - /** - * Form submission handler. - * - * @param array $form - * An associative array containing the structure of the form. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // Empty implementation of the abstract submit class. - } - - /** - * Defines the settings form for Simple mega menu entities. - * - * @param array $form - * An associative array containing the structure of the form. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return array - * Form definition array. - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form['SimpleMegaMenu_settings']['#markup'] = 'Settings form for Simple mega menu entities. Manage field settings here.'; - return $form; - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeDeleteForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeDeleteForm.php deleted file mode 100644 index aa13ee42fc..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeDeleteForm.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Entity\EntityDeleteForm; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; - -/** - * Builds the form to delete Simple mega menu type entities. - */ -class SimpleMegaMenuTypeDeleteForm extends EntityDeleteForm { - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('entity.simple_mega_menu_type.collection'); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return $this->t('Delete'); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $entities = $this->entityTypeManager->getStorage('simple_mega_menu')->getQuery() - ->condition('type', $this->entity->id()) - ->count() - ->execute(); - if ($entities) { - $caption = '<p>' . $this->formatPlural($entities, '%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', '%type is used by @count pieces of content on your site. You may not remove %type until you have removed all of the %type content.', ['%type' => $this->entity->label()]) . '</p>'; - $form['#title'] = $this->getQuestion(); - $form['description'] = ['#markup' => $caption]; - return $form; - } - - return parent::buildForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $this->entity->delete(); - - drupal_set_message( - $this->t('content @type: deleted @label.', - [ - '@type' => $this->entity->bundle(), - '@label' => $this->entity->label(), - ] - ) - ); - - $form_state->setRedirectUrl($this->getCancelUrl()); - } - -} diff --git a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeForm.php b/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeForm.php deleted file mode 100644 index 2f81b79739..0000000000 --- a/web/modules/simple_megamenu/src/Form/SimpleMegaMenuTypeForm.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Form; - -use Drupal\Core\Entity\EntityForm; -use Drupal\Core\Form\FormStateInterface; - -/** - * Class SimpleMegaMenuTypeForm. - * - * @package Drupal\simple_megamenu\Form - */ -class SimpleMegaMenuTypeForm extends EntityForm { - - /** - * {@inheritdoc} - */ - public function form(array $form, FormStateInterface $form_state) { - $form = parent::form($form, $form_state); - - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface $simple_mega_menu_type */ - $simple_mega_menu_type = $this->entity; - $form['label'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#maxlength' => 255, - '#default_value' => $simple_mega_menu_type->label(), - '#description' => $this->t("Label for the Simple mega menu type."), - '#required' => TRUE, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => $simple_mega_menu_type->id(), - '#machine_name' => [ - 'exists' => '\Drupal\simple_megamenu\Entity\SimpleMegaMenuType::load', - ], - '#disabled' => !$simple_mega_menu_type->isNew(), - ]; - - $options = menu_ui_get_menus(); - $form['targetMenu'] = [ - '#type' => 'checkboxes', - '#title' => $this->t('Target menu'), - '#default_value' => $simple_mega_menu_type->getTargetMenu(), - '#options' => $options, - '#required' => TRUE, - '#description' => $this->t("Select the menus on which use this mega menu type."), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function save(array $form, FormStateInterface $form_state) { - $simple_mega_menu_type = $this->entity; - $status = $simple_mega_menu_type->save(); - - switch ($status) { - case SAVED_NEW: - drupal_set_message($this->t('Created the %label Simple mega menu type.', [ - '%label' => $simple_mega_menu_type->label(), - ])); - break; - - default: - drupal_set_message($this->t('Saved the %label Simple mega menu type.', [ - '%label' => $simple_mega_menu_type->label(), - ])); - } - $form_state->setRedirectUrl($simple_mega_menu_type->toUrl('collection')); - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuAccessControlHandler.php b/web/modules/simple_megamenu/src/SimpleMegaMenuAccessControlHandler.php deleted file mode 100644 index 8bc52eed0a..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuAccessControlHandler.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\EntityAccessControlHandler; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Access\AccessResult; - -/** - * Access controller for the Simple mega menu entity. - * - * @see \Drupal\simple_megamenu\Entity\SimpleMegaMenu. - */ -class SimpleMegaMenuAccessControlHandler extends EntityAccessControlHandler { - - /** - * {@inheritdoc} - */ - protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) { - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $entity */ - switch ($operation) { - case 'view': - if (!$entity->isPublished()) { - return AccessResult::allowedIfHasPermission($account, 'view unpublished simple mega menu entities'); - } - return AccessResult::allowedIfHasPermission($account, 'view published simple mega menu entities'); - - case 'update': - return AccessResult::allowedIfHasPermission($account, 'edit simple mega menu entities'); - - case 'delete': - return AccessResult::allowedIfHasPermission($account, 'delete simple mega menu entities'); - } - - // Unknown operation, no opinion. - return AccessResult::neutral(); - } - - /** - * {@inheritdoc} - */ - protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { - return AccessResult::allowedIfHasPermission($account, 'add simple mega menu entities'); - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuHelper.php b/web/modules/simple_megamenu/src/SimpleMegaMenuHelper.php deleted file mode 100644 index de83157854..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuHelper.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface; - -/** - * Class SimpleMegaMenuHelper. - * - * @package Drupal\simple_megamenu - */ -class SimpleMegaMenuHelper implements SimpleMegaMenuHelperInterface { - - /** - * Drupal\Core\Entity\EntityTypeManagerInterface definition. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructor. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - public function getTargetMenus(SimpleMegaMenuTypeInterface $entity) { - return array_filter($entity->getTargetMenu()); - } - - /** - * {@inheritdoc} - */ - public function getMegaMenuTypeWhichTargetMenu($menu_name) { - $mega_menu_types = []; - $simple_mega_menu_types = $this->entityTypeManager->getStorage('simple_mega_menu_type')->loadMultiple(); - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuType $entity */ - foreach ($simple_mega_menu_types as $id => $entity) { - $target_menus = $this->getTargetMenus($entity); - if (in_array($menu_name, $target_menus)) { - $mega_menu_types[$id] = $entity->label(); - } - } - return $mega_menu_types; - } - - /** - * {@inheritdoc} - */ - public function menuIsTargetedByMegaMenuType($menu_name) { - $simple_mega_menu_types = $this->entityTypeManager->getStorage('simple_mega_menu_type')->loadMultiple(); - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuType $entity */ - foreach ($simple_mega_menu_types as $id => $entity) { - $target_menus = $this->getTargetMenus($entity); - if (in_array($menu_name, $target_menus)) { - return TRUE; - } - } - return FALSE; - } - - /** - * {@inheritdoc} - */ - public function getSimpleMegaMenuType($id) { - $simpleMegaMenuType = $this->entityTypeManager->getStorage('simple_mega_menu_type')->load($id); - return $simpleMegaMenuType; - } - - /** - * {@inheritdoc} - */ - public function getSimpleMegaMenu($id) { - $simpleMegaMenu = $this->entityTypeManager->getStorage('simple_mega_menu')->load($id); - return $simpleMegaMenu; - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuHelperInterface.php b/web/modules/simple_megamenu/src/SimpleMegaMenuHelperInterface.php deleted file mode 100644 index a3eab463f3..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuHelperInterface.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface; - -/** - * Interface SimpleMegaMenuHelperInterface. - * - * @package Drupal\simple_megamenu - */ -interface SimpleMegaMenuHelperInterface { - - /** - * Gets the menus targeted by a specific Simple mega menu type. - * - * @param \Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface $entity - * The Simple mega menu type entity. - * - * @return array - * The menus targeted by the config entity. - */ - public function getTargetMenus(SimpleMegaMenuTypeInterface $entity); - - /** - * Get SimpleMegaMenuType entities which target a menu. - * - * @param string $menu_name - * The menu name. - * - * @return array - * An array keyed by the SimpleMegaMenuType id and with the label as value. - * Otherwise, an empty array. - */ - public function getMegaMenuTypeWhichTargetMenu($menu_name); - - /** - * Is the menu is referenced by a SimpleMegaMenuType entity. - * - * @param string $menu_name - * The menu name. - * - * @return bool - * TRUE, if the menu is targeted by a SimpleMegaMenuType entity. - * Otherwise, FALSE. - */ - public function menuIsTargetedByMegaMenuType($menu_name); - - /** - * Get a SimpleMegaMenuType entity. - * - * @param string $id - * The SimpleMegaMenuType id. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface $entity - * The SimpleMegaMenuTypeInterface entity. - */ - public function getSimpleMegaMenuType($id); - - /** - * Get a SimpleMegaMenu entity. - * - * @param string $id - * The SimpleMegaMenu id. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $entity - * The SimpleMegaMenuInterface entity. - */ - public function getSimpleMegaMenu($id); - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuHtmlRouteProvider.php b/web/modules/simple_megamenu/src/SimpleMegaMenuHtmlRouteProvider.php deleted file mode 100644 index 379b72d78a..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuHtmlRouteProvider.php +++ /dev/null @@ -1,225 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider; -use Symfony\Component\Routing\Route; - -/** - * Provides routes for Simple mega menu entities. - * - * @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider - * @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider - */ -class SimpleMegaMenuHtmlRouteProvider extends AdminHtmlRouteProvider { - - /** - * {@inheritdoc} - */ - public function getRoutes(EntityTypeInterface $entity_type) { - $collection = parent::getRoutes($entity_type); - - $entity_type_id = $entity_type->id(); - - if ($collection_route = $this->getCollectionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.collection", $collection_route); - } - - if ($history_route = $this->getHistoryRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.version_history", $history_route); - } - - if ($revision_route = $this->getRevisionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision", $revision_route); - } - - if ($revert_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_revert", $revert_route); - } - - if ($delete_route = $this->getRevisionDeleteRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.revision_delete", $delete_route); - } - - if ($translation_route = $this->getRevisionTranslationRevertRoute($entity_type)) { - $collection->add("{$entity_type_id}.revision_revert_translation_confirm", $translation_route); - } - - if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { - $collection->add("$entity_type_id.settings", $settings_form_route); - } - - return $collection; - } - - /** - * Gets the collection route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getCollectionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('collection')); - $route - ->setDefaults([ - '_entity_list' => $entity_type_id, - '_title' => "{$entity_type->getLabel()} list", - ]) - ->setRequirement('_permission', 'access simple mega menu overview') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the version history route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getHistoryRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('version-history')) { - $route = new Route($entity_type->getLinkTemplate('version-history')); - $route - ->setDefaults([ - '_title' => "{$entity_type->getLabel()} revisions", - '_controller' => '\Drupal\simple_megamenu\Controller\SimpleMegaMenuController::revisionOverview', - ]) - ->setRequirement('_permission', 'access simple mega menu revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision')) { - $route = new Route($entity_type->getLinkTemplate('revision')); - $route - ->setDefaults([ - '_controller' => '\Drupal\simple_megamenu\Controller\SimpleMegaMenuController::revisionShow', - '_title_callback' => '\Drupal\simple_megamenu\Controller\SimpleMegaMenuController::revisionPageTitle', - ]) - ->setRequirement('_permission', 'access simple mega menu revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_revert')) { - $route = new Route($entity_type->getLinkTemplate('revision_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\simple_megamenu\Form\SimpleMegaMenuRevisionRevertForm', - '_title' => 'Revert to earlier revision', - ]) - ->setRequirement('_permission', 'revert all simple mega menu revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision delete route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionDeleteRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision_delete')) { - $route = new Route($entity_type->getLinkTemplate('revision_delete')); - $route - ->setDefaults([ - '_form' => '\Drupal\simple_megamenu\Form\SimpleMegaMenuRevisionDeleteForm', - '_title' => 'Delete earlier revision', - ]) - ->setRequirement('_permission', 'delete all simple mega menu revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the revision translation revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionTranslationRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('translation_revert')) { - $route = new Route($entity_type->getLinkTemplate('translation_revert')); - $route - ->setDefaults([ - '_form' => '\Drupal\simple_megamenu\Form\SimpleMegaMenuRevisionRevertTranslationForm', - '_title' => 'Revert to earlier revision of a translation', - ]) - ->setRequirement('_permission', 'revert all simple mega menu revisions') - ->setOption('_admin_route', TRUE); - - return $route; - } - } - - /** - * Gets the settings form route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { - if (!$entity_type->getBundleEntityType()) { - $route = new Route("/admin/structure/{$entity_type->id()}/settings"); - $route - ->setDefaults([ - '_form' => 'Drupal\simple_megamenu\Form\SimpleMegaMenuSettingsForm', - '_title' => "{$entity_type->getLabel()} settings", - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuListBuilder.php b/web/modules/simple_megamenu/src/SimpleMegaMenuListBuilder.php deleted file mode 100644 index 4bb4ffdc50..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuListBuilder.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityListBuilder; -use Drupal\Core\Routing\LinkGeneratorTrait; -use Drupal\Core\Url; -use Drupal\Component\Render\FormattableMarkup; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\EntityTypeBundleInfoInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Link; - -/** - * Defines a class to build a listing of Simple mega menu entities. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuListBuilder extends EntityListBuilder { - - use LinkGeneratorTrait; - - /** - * The entity type manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * The bundle info interface. - * - * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface - */ - protected $bundleInfo; - - /** - * Constructs a new EntityListBuilder object. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type definition. - * @param \Drupal\Core\Entity\EntityStorageInterface $storage - * The entity storage class. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager - * The Entity type manager service. - * @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundleInfo - * The bundle info service. - */ - public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, EntityTypeManagerInterface $entityTypeManager, EntityTypeBundleInfoInterface $bundleInfo) { - parent::__construct($entity_type, $storage); - $this->entityTypeManager = $entityTypeManager; - $this->bundleInfo = $bundleInfo; - } - - /** - * {@inheritdoc} - */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static( - $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), - $container->get('entity_type.manager'), - $container->get('entity_type.bundle.info') - ); - } - - /** - * {@inheritdoc} - */ - public function buildHeader() { - $header['id'] = $this->t('Simple mega menu ID'); - $header['name'] = $this->t('Name'); - $header['type'] = $this->t('Type'); - $header['target_menu'] = $this->t('Target Menu'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - /* @var $entity \Drupal\simple_megamenu\Entity\SimpleMegaMenu */ - $row['id'] = $entity->id(); - $row['name'] = Link::fromTextAndUrl( - $entity->label(), - new Url( - 'entity.simple_mega_menu.edit_form', [ - 'simple_mega_menu' => $entity->id(), - ] - ) - ); - - $bundle = $entity->bundle(); - /* @var \Drupal\simple_megamenu\Entity\SimpleMegaMenuTypeInterface $simple_mega_menu_type */ - $simple_mega_menu_type = $this->entityTypeManager->getStorage('simple_mega_menu_type')->load($bundle); - - $row['type'] = $simple_mega_menu_type->label(); - - $target_menus = $simple_mega_menu_type->getTargetMenu(); - $target_menus = array_filter($target_menus); - $menu_labels = []; - foreach ($target_menus as $menu_name) { - $menu_labels[] = $this->entityTypeManager->getStorage('menu')->load($menu_name)->label(); - } - $labels = implode(', ', $menu_labels); - $row['target_menu'] = new FormattableMarkup('@labels', [ - '@labels' => $labels, - ]); - - return $row + parent::buildRow($entity); - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuStorage.php b/web/modules/simple_megamenu/src/SimpleMegaMenuStorage.php deleted file mode 100644 index d4661e75e7..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuStorage.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\Sql\SqlContentEntityStorage; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Language\LanguageInterface; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; - -/** - * Defines the storage handler class for Simple mega menu entities. - * - * This extends the base storage class, adding required special handling for - * Simple mega menu entities. - * - * @ingroup simple_megamenu - */ -class SimpleMegaMenuStorage extends SqlContentEntityStorage implements SimpleMegaMenuStorageInterface { - - /** - * {@inheritdoc} - */ - public function revisionIds(SimpleMegaMenuInterface $entity) { - return $this->database->query( - 'SELECT vid FROM {simple_mega_menu_revision} WHERE id=:id ORDER BY vid', - [':id' => $entity->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function userRevisionIds(AccountInterface $account) { - return $this->database->query( - 'SELECT vid FROM {simple_mega_menu_field_revision} WHERE uid = :uid ORDER BY vid', - [':uid' => $account->id()] - )->fetchCol(); - } - - /** - * {@inheritdoc} - */ - public function countDefaultLanguageRevisions(SimpleMegaMenuInterface $entity) { - return $this->database->query('SELECT COUNT(*) FROM {simple_mega_menu_field_revision} WHERE id = :id AND default_langcode = 1', [':id' => $entity->id()]) - ->fetchField(); - } - - /** - * {@inheritdoc} - */ - public function clearRevisionsLanguage(LanguageInterface $language) { - return $this->database->update('simple_mega_menu_revision') - ->fields(['langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED]) - ->condition('langcode', $language->getId()) - ->execute(); - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuStorageInterface.php b/web/modules/simple_megamenu/src/SimpleMegaMenuStorageInterface.php deleted file mode 100644 index d5d54a530f..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuStorageInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\ContentEntityStorageInterface; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Language\LanguageInterface; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; - -/** - * Defines the storage handler class for Simple mega menu entities. - * - * This extends the base storage class, adding required special handling for - * Simple mega menu entities. - * - * @ingroup simple_megamenu - */ -interface SimpleMegaMenuStorageInterface extends ContentEntityStorageInterface { - - /** - * Gets a list of Simple megamenu revision IDs for a specific Simple megamenu. - * - * @param \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $entity - * The Simple mega menu entity. - * - * @return int[] - * Simple mega menu revision IDs (in ascending order). - */ - public function revisionIds(SimpleMegaMenuInterface $entity); - - /** - * Gets a list of revision IDs having a given user as Simple mega menu author. - * - * @param \Drupal\Core\Session\AccountInterface $account - * The user entity. - * - * @return int[] - * Simple mega menu revision IDs (in ascending order). - */ - public function userRevisionIds(AccountInterface $account); - - /** - * Counts the number of revisions in the default language. - * - * @param \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface $entity - * The Simple mega menu entity. - * - * @return int - * The number of revisions in the default language. - */ - public function countDefaultLanguageRevisions(SimpleMegaMenuInterface $entity); - - /** - * Unsets the language for all Simple mega menu with the given language. - * - * @param \Drupal\Core\Language\LanguageInterface $language - * The language object. - */ - public function clearRevisionsLanguage(LanguageInterface $language); - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuTranslationHandler.php b/web/modules/simple_megamenu/src/SimpleMegaMenuTranslationHandler.php deleted file mode 100644 index f9b26c59c2..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuTranslationHandler.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\content_translation\ContentTranslationHandler; - -/** - * Defines the translation handler for simple_mega_menu. - */ -class SimpleMegaMenuTranslationHandler extends ContentTranslationHandler { - - // Override here the needed methods from ContentTranslationHandler. -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuTypeHtmlRouteProvider.php b/web/modules/simple_megamenu/src/SimpleMegaMenuTypeHtmlRouteProvider.php deleted file mode 100644 index d6023df3c6..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuTypeHtmlRouteProvider.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider; -use Symfony\Component\Routing\Route; - -/** - * Provides routes for Simple mega menu type entities. - * - * @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider - * @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider - */ -class SimpleMegaMenuTypeHtmlRouteProvider extends AdminHtmlRouteProvider { - - /** - * {@inheritdoc} - */ - public function getRoutes(EntityTypeInterface $entity_type) { - $collection = parent::getRoutes($entity_type); - - $entity_type_id = $entity_type->id(); - - if ($collection_route = $this->getCollectionRoute($entity_type)) { - $collection->add("entity.{$entity_type_id}.collection", $collection_route); - } - - return $collection; - } - - /** - * Gets the collection route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getCollectionRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('collection')); - $route - ->setDefaults([ - '_entity_list' => $entity_type_id, - // Make sure this is not a TranslatableMarkup object as the - // TitleResolver translates this string again. - '_title' => (string) $entity_type->getLabel(), - ]) - ->setRequirement('_permission', $entity_type->getAdminPermission()) - ->setOption('_admin_route', TRUE); - - return $route; - } - } - -} diff --git a/web/modules/simple_megamenu/src/SimpleMegaMenuTypeListBuilder.php b/web/modules/simple_megamenu/src/SimpleMegaMenuTypeListBuilder.php deleted file mode 100644 index db6ef91f5f..0000000000 --- a/web/modules/simple_megamenu/src/SimpleMegaMenuTypeListBuilder.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu; - -use Drupal\Core\Config\Entity\ConfigEntityListBuilder; -use Drupal\Core\Entity\EntityInterface; - -/** - * Provides a listing of Simple mega menu type entities. - */ -class SimpleMegaMenuTypeListBuilder extends ConfigEntityListBuilder { - - /** - * {@inheritdoc} - */ - public function buildHeader() { - $header['label'] = $this->t('Simple mega menu type'); - $header['id'] = $this->t('Machine name'); - return $header + parent::buildHeader(); - } - - /** - * {@inheritdoc} - */ - public function buildRow(EntityInterface $entity) { - $row['label'] = $entity->label(); - $row['id'] = $entity->id(); - // You probably want a few more properties here... - return $row + parent::buildRow($entity); - } - -} diff --git a/web/modules/simple_megamenu/src/Tests/SimpleMegaMenuTest.php b/web/modules/simple_megamenu/src/Tests/SimpleMegaMenuTest.php deleted file mode 100644 index 8bf78d72f5..0000000000 --- a/web/modules/simple_megamenu/src/Tests/SimpleMegaMenuTest.php +++ /dev/null @@ -1,251 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\Tests; - -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenu; -use Drupal\simpletest\WebTestBase; -use Drupal\menu_link_content\Entity\MenuLinkContent; - -/** - * Simple test to ensure that main page loads with module enabled. - * - * @group simple_megamenu - */ -class SimpleMegaMenuTest extends WebTestBase { - - /** - * Modules to enable. - * - * @var array - */ - public static $modules = [ - 'system', - 'language', - 'user', - 'link', - 'file', - 'image', - 'content_translation', - 'text', - 'menu_ui', - 'menu_link_content', - 'field', - 'field_ui', - 'simple_megamenu', - 'simple_megamenu_example', - ]; - - /** - * A user with permission to administer site configuration. - * - * @var \Drupal\user\UserInterface - */ - protected $user; - - /** - * A user with permission to view mega menu entities only. - * - * @var \Drupal\user\UserInterface - */ - protected $normalUser; - - /** - * The profile to install as a basis for testing. - * - * @var string - */ - protected $profile = 'standard'; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - $this->normalUser = $this->drupalCreateUser([ - 'view published simple mega menu entities', - ]); - - $this->user = $this->drupalCreateUser([ - 'administer site configuration', - 'administer menu', - 'administer blocks', - 'access simple mega menu entities canonical page', - 'view published simple mega menu entities', - 'view unpublished simple mega menu entities', - 'add simple mega menu entities', - 'edit simple mega menu entities', - 'access simple mega menu overview', - ]); - $this->drupalLogin($this->user); - - // Set the mmain menu block ti an unlimited level. - $block_main_menu_path = '/admin/structure/block/manage/bartik_main_menu'; - $edit = [ - 'settings[depth]' => '0', - ]; - $this->drupalPostForm($block_main_menu_path, $edit, t('Save block')); - } - - /** - * Creates a menu link given text and path. - * - * @param string $text - * The menu link text. - * @param string $path - * The menu link path. - * Available path : 'route:<front>' or 'internal:/people' or - * 'entity:node/' . $node->id(). - * @param int $weight - * The menu link weight. - * @param string $menu - * The menu to add the link to. - * @param int $expanded - * The menu link is expanded or not if it has children. - * @param string $parent - * The parent menu item uuid to attach the link to. - * @param string $langcode - * The langcode. - * - * @return \Drupal\menu_link_content\Entity\MenuLinkContent - * The saved menu link. - */ - public function createMenuLink($text, $path, $weight = 0, $menu = 'main', $expanded = 1, $parent = NULL, $langcode = 'en') { - /* @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */ - $menu_link = MenuLinkContent::create([ - 'title' => $text, - 'link' => ['uri' => $path], - 'menu_name' => $menu, - 'weight' => $weight, - 'expanded' => $expanded, - 'langcode' => $langcode, - ]); - if ($parent !== NULL) { - $menu_link->set('parent', 'menu_link_content:' . $parent); - } - $menu_link->save(); - return $menu_link; - } - - /** - * Create a MegaMenu entity. - * - * @param string $type - * The type. - * @param string $title - * The title. - * @param string $langcode - * The langcode. - * @param string $uid - * The author uid. - * @param array $fields - * Fields to set. - * @param bool $status - * The publishing status. - * - * @return \Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface - * The mega menu created. - */ - public function createMegaMenu($type, $title, $langcode, $uid = '1', array $fields = [], $status = TRUE) { - /* @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */ - $mega_menu = SimpleMegaMenu::create([ - 'type' => $type, - 'name' => $title, - 'uid' => $uid, - 'status' => $status, - 'langcode' => $langcode, - ]); - if (empty($fields)) { - $mega_menu->save(); - return $mega_menu; - } - - else { - foreach ($fields as $field_name => $value) { - if ($mega_menu->hasField($field_name)) { - $mega_menu->set($field_name, $value); - } - } - - $mega_menu->save(); - return $mega_menu; - } - } - - /** - * Tests that the home page loads with a 200 response. - */ - public function testMegaMenu() { - - $content_path = '/admin/content/simple_mega_menu/add/megamenu'; - // Check that the field appears in the form. - $this->drupalGet($content_path); - $this->assertFieldByName('name[0][value]'); - $this->assertFieldByName('field_image_title[0][value]'); - $this->assertFieldByName('field_image_link[0][uri]'); - $this->assertFieldByName('field_text[0][value]'); - $this->assertFieldByName('field_links[0][uri]'); - $this->assertFieldByName('field_links[0][title]'); - $this->assertText(t('The name of the Simple mega menu entity.')); - $this->assertResponse(200); - - // Create a mage menu entity with some fields filled. - $fields = [ - 'field_text' => [ - 'value' => 'CTA text for mega menu', - ], - 'field_links' => [ - 0 => [ - 'uri' => 'https://www.flocondetoile.fr', - 'title' => 'See Flocon de toile', - ], - 1 => [ - 'uri' => 'route:<front>', - 'title' => 'Contact us', - ], - ], - ]; - /* @var \Drupal\simple_megamenu\Entity\SimpleMegaMenu $mega_menu */ - $mega_menu = $this->createMegaMenu('megamenu', 'Services', 'en', $this->user->id(), $fields); - - // Create some Menu link content. - $menu_service = $this->createMenuLink('Services main', 'route:<front>'); - $menu_service_child = $this->createMenuLink('Services child', 'route:<front>', 0, 'main', 1, $menu_service->uuid()); - - $menu_path = '/admin/structure/menu/item/'; - - $this->drupalGet($menu_path . $menu_service->id() . '/edit'); - $this->assertResponse(200); - $this->assertFieldByName('simple_mega_menu'); - - $edit = [ - 'simple_mega_menu' => $mega_menu->label() . ' (' . $mega_menu->id() . ')', - ]; - $this->drupalPostForm($menu_path . $menu_service->id() . '/edit', $edit, t('Save')); - $this->assertText(t('The menu link has been saved.')); - - $this->drupalGet(Url::fromRoute('<front>')); - $this->assertText(t('Services main')); - // Check the Meega menu is present. - $this->assertText(t('CTA text for mega menu')); - $this->assertText(t('See Flocon de toile')); - $this->assertText(t('Contact us')); - - // Access to the canonical page. - $this->drupalGet('/admin/content/simple_mega_menu/' . $mega_menu->id()); - $this->assertResponse('200'); - - $this->drupalLogout(); - $this->drupalLogin($this->normalUser); - - $this->drupalGet('/admin/content/simple_mega_menu/' . $mega_menu->id()); - $this->assertResponse('404'); - - /* @var \Drupal\simple_megamenu\Entity\SimpleMegaMenu $mega_menu */ - $mega_menu2 = $this->createMegaMenu('megamenu', 'Services2', 'en', $this->user->id(), $fields); - $mega_menu2->delete(); - - } - -} diff --git a/web/modules/simple_megamenu/src/TwigExtension/SimpleMegaMenuTwigExtension.php b/web/modules/simple_megamenu/src/TwigExtension/SimpleMegaMenuTwigExtension.php deleted file mode 100644 index a0b5864926..0000000000 --- a/web/modules/simple_megamenu/src/TwigExtension/SimpleMegaMenuTwigExtension.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -namespace Drupal\simple_megamenu\TwigExtension; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Url; -use Drupal\simple_megamenu\Entity\SimpleMegaMenuInterface; - -/** - * Class SimpleMegaMenuTwigExtension. - * - * @package Drupal\simple_megamenu - */ -class SimpleMegaMenuTwigExtension extends \Twig_Extension { - - /** - * Drupal\Core\Entity\EntityTypeManagerInterface definition. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs \Drupal\Core\Template\TwigExtension. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager service. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - public function getFunctions() { - return [ - new \Twig_SimpleFunction('view_megamenu', [$this, 'viewMegaMenu']), - new \Twig_SimpleFunction('has_megamenu', [$this, 'hasMegaMenu']), - ]; - } - - /** - * Render a mega menu in a view from an Url object. - * - * @param \Drupal\Core\Url|string $url - * The URL object used for the link. - * @param string $view_mode - * The view mode to use for rendering the mega menu. - * - * @return array - * A render array representing a the megamenu for the given view mode. - */ - public function viewMegaMenu(Url $url, $view_mode = 'default') { - if (!$url instanceof Url) { - return []; - } - - if (!$this->hasMegaMenu($url)) { - return []; - } - - $build = []; - $menu_attributes = $url->getOption('attributes'); - $simple_mega_menu_id = $menu_attributes['data-simple-mega-menu']; - /** @var \Drupal\simple_megamenu\Entity\SimpleMegaMenu $simple_mega_menu */ - $simple_mega_menu = $this->entityTypeManager->getStorage('simple_mega_menu')->load($simple_mega_menu_id); - if ($simple_mega_menu instanceof SimpleMegaMenuInterface) { - if (!$simple_mega_menu->access('view')) { - return $build; - } - $viewBuilder = $this->entityTypeManager->getViewBuilder($simple_mega_menu->getEntityTypeId()); - $build = $viewBuilder->view($simple_mega_menu, $view_mode); - } - - return $build; - } - - /** - * Check if a mega menu is referenced by an Url object. - * - * @param \Drupal\Core\Url|string $url - * The URL object used for the link. - * - * @return bool - * TRUE if a simple mega menu entity is reference by the Url object. - */ - public function hasMegaMenu(Url $url) { - if (!$url instanceof Url) { - return FALSE; - } - $menu_attributes = $url->getOption('attributes'); - if (isset($menu_attributes['data-simple-mega-menu']) && !empty($menu_attributes['data-simple-mega-menu'])) { - return TRUE; - } - - return FALSE; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return 'simple_megamenu.twig.extension'; - } - -} diff --git a/web/modules/simple_megamenu/templates/menu--simple-megamenu.html.twig b/web/modules/simple_megamenu/templates/menu--simple-megamenu.html.twig deleted file mode 100644 index 98bef62dab..0000000000 --- a/web/modules/simple_megamenu/templates/menu--simple-megamenu.html.twig +++ /dev/null @@ -1,65 +0,0 @@ -{# -/** - * @file - * Theme override to display a 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. - */ -#} -{% import _self as menus %} - -{# - We call a macro which calls itself to render the full tree. - @see http://twig.sensiolabs.org/doc/tags/macro.html -#} -{{ attach_library('simple_megamenu/base') }} -{{ menus.menu_links(items, attributes, 0) }} - -{% macro menu_links(items, attributes, menu_level) %} - {% import _self as menus %} - {% if items %} - {% if menu_level == 0 %} - <ul{{ attributes.addClass('menu', 'menu--simple-mega-menu') }}> - {% else %} - <ul {{ attributes.removeClass('menu--simple-mega-menu') }}> - {% endif %} - {% for item in items %} - {% - set classes = [ - 'menu-item', - item.is_expanded ? 'menu-item--expanded', - item.is_collapsed ? 'menu-item--collapsed', - item.in_active_trail ? 'menu-item--active-trail', - ] - %} - <li{{ item.attributes.addClass(classes) }}> - {{ link(item.title, item.url) }} - {% if item.below %} - {% if has_megamenu(item.url) %} - <div class="mega-menu-wrapper"> - <div class="mega-menu-background"></div> - {{ view_megamenu(item.url, 'before') }} - {{ menus.menu_links(item.below, attributes.addClass('mega-menu-item'), menu_level + 1) }} - {{ view_megamenu(item.url, 'after') }} - </div> - {% else %} - {{ menus.menu_links(item.below, attributes.removeClass('mega-menu-item'), menu_level + 1) }} - {% endif %} - {% endif %} - </li> - {% endfor %} - </ul> - {% endif %} -{% endmacro %} diff --git a/web/modules/simple_megamenu/templates/simple-mega-menu-content-add-list.html.twig b/web/modules/simple_megamenu/templates/simple-mega-menu-content-add-list.html.twig deleted file mode 100644 index e844241c25..0000000000 --- a/web/modules/simple_megamenu/templates/simple-mega-menu-content-add-list.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Default theme implementation to present a list of custom content entity types/bundles. - * - * Available variables: - * - types: A collection of all the available custom entity types/bundles. - * Each type/bundle contains the following: - * - link: A link to add a content entity of this type. - * - description: A description of this content entity types/bundle. - * - * @see template_preprocess_simple_mega_menu_content_add_list() - * - * @ingroup themeable - */ -#} -{% spaceless %} - <dl> - {% for type in types %} - <dt>{{ type.link }}</dt> - {% endfor %} - </dl> -{% endspaceless %} diff --git a/web/modules/simple_megamenu/templates/simple-mega-menu.html.twig b/web/modules/simple_megamenu/templates/simple-mega-menu.html.twig deleted file mode 100644 index 8ab74f945b..0000000000 --- a/web/modules/simple_megamenu/templates/simple-mega-menu.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{# -/** - * @file simple_mega_menu.html.twig - * Default theme implementation to present Simple mega menu data. - * - * This template is used when viewing Simple mega menu pages. - * - * - * Available variables: - * - content: A list of content items. Use 'content' to print all content, or - * - attributes: HTML attributes for the container element. - * - bundle : the simple mega menu bundle - * - view_mode : the view mode used - * - simple_mega_menu: the simple mega menu entity - * - * @see template_preprocess_simple_mega_menu() - * - * @ingroup themeable - */ -#} - -{% -set classes = [ -'simple-mega-menu', -'mega-menu-item', -'simple-mega-menu-type-' ~ bundle|clean_class, -view_mode ? 'view-mode-' ~ view_mode|clean_class, -] -%} - -<div{{ attributes.addClass(classes) }}> - {% if content %} - {{- content -}} - {% endif %} -</div> -- GitLab