From b6517103fef7bc1c108b1a7852c5179d68caecd6 Mon Sep 17 00:00:00 2001 From: bcweaver <brianweaver@gmail.com> Date: Tue, 23 Oct 2018 17:29:35 -0400 Subject: [PATCH] Removing unused 'layout_plugin' package --- composer.json | 1 - composer.lock | 61 +-- vendor/composer/installed.json | 61 --- web/modules/layout_plugin/LICENSE.txt | 339 ---------------- web/modules/layout_plugin/composer.json | 21 - .../config/schema/layout_plugin.schema.yml | 9 - .../layout_plugin/layout_plugin.api.php | 26 -- .../layout_plugin/layout_plugin.drush.inc | 85 ---- .../layout_plugin/layout_plugin.info.yml | 11 - .../layout_plugin/layout_plugin.module | 64 --- .../layout_plugin/layout_plugin.services.yml | 4 - .../schema/layout_plugin_example.schema.yml | 7 - .../css/layout-example-1col.css | 1 - .../css/layout-example-2col.css | 16 - .../layout_plugin_example.info.yml | 14 - .../layout_plugin_example.layouts.yml | 21 - .../src/Plugin/Layout/LayoutExampleTest.php | 65 ---- .../templates/layout-example-1col.html.twig | 14 - .../templates/layout-example-2col.html.twig | 14 - .../templates/layout-example-test.html.twig | 18 - .../layout_plugin/src/Annotation/Layout.php | 154 -------- web/modules/layout_plugin/src/Layout.php | 88 ----- .../src/Plugin/Layout/LayoutBase.php | 179 --------- .../src/Plugin/Layout/LayoutDefault.php | 10 - .../src/Plugin/Layout/LayoutInterface.php | 25 -- .../src/Plugin/Layout/LayoutPluginManager.php | 258 ------------ .../Layout/LayoutPluginManagerInterface.php | 62 --- .../config/schema/layout_test.schema.yml | 7 - .../layout_test/css/layout-test-1col.css | 1 - .../layout_test/css/layout-test-2col.css | 16 - .../modules/layout_test/layout_test.info.yml | 12 - .../layout_test/layout_test.layouts.yml | 21 - .../layout_test/layout_test.libraries.yml | 11 - .../src/Plugin/Layout/LayoutTestPlugin.php | 59 --- .../templates/layout-test-1col.html.twig | 14 - .../templates/layout-test-2col.html.twig | 14 - .../templates/layout-test-plugin.html.twig | 15 - .../tests/src/Kernel/LayoutTest.php | 141 ------- .../tests/src/Unit/PluginManagerTest.php | 368 ------------------ 39 files changed, 1 insertion(+), 2306 deletions(-) delete mode 100644 web/modules/layout_plugin/LICENSE.txt delete mode 100644 web/modules/layout_plugin/composer.json delete mode 100644 web/modules/layout_plugin/config/schema/layout_plugin.schema.yml delete mode 100644 web/modules/layout_plugin/layout_plugin.api.php delete mode 100644 web/modules/layout_plugin/layout_plugin.drush.inc delete mode 100644 web/modules/layout_plugin/layout_plugin.info.yml delete mode 100644 web/modules/layout_plugin/layout_plugin.module delete mode 100644 web/modules/layout_plugin/layout_plugin.services.yml delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/config/schema/layout_plugin_example.schema.yml delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-1col.css delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-2col.css delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.info.yml delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.layouts.yml delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/src/Plugin/Layout/LayoutExampleTest.php delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-1col.html.twig delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-2col.html.twig delete mode 100644 web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-test.html.twig delete mode 100644 web/modules/layout_plugin/src/Annotation/Layout.php delete mode 100644 web/modules/layout_plugin/src/Layout.php delete mode 100644 web/modules/layout_plugin/src/Plugin/Layout/LayoutBase.php delete mode 100644 web/modules/layout_plugin/src/Plugin/Layout/LayoutDefault.php delete mode 100644 web/modules/layout_plugin/src/Plugin/Layout/LayoutInterface.php delete mode 100644 web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManager.php delete mode 100644 web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManagerInterface.php delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/config/schema/layout_test.schema.yml delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-1col.css delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-2col.css delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/layout_test.info.yml delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/layout_test.layouts.yml delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/layout_test.libraries.yml delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-1col.html.twig delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-2col.html.twig delete mode 100644 web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-plugin.html.twig delete mode 100644 web/modules/layout_plugin/tests/src/Kernel/LayoutTest.php delete mode 100644 web/modules/layout_plugin/tests/src/Unit/PluginManagerTest.php diff --git a/composer.json b/composer.json index 54ad0dcd6a..b29aa677d1 100644 --- a/composer.json +++ b/composer.json @@ -112,7 +112,6 @@ "drupal/image_popup": "1.1", "drupal/imce": "1.6", "drupal/inline_entity_form": "1.0-beta1", - "drupal/layout_plugin": "1.0-alpha23", "drupal/link_attributes": "1.0", "drupal/linkit": "5.0-beta6", "drupal/magnific_popup": "1.3", diff --git a/composer.lock b/composer.lock index daa98a4360..33dfdbfe6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b37ad91cff6e56b6de95d0612dbc4cb6", + "content-hash": "0cd0f0de847de5ff340edac07d7c2d76", "packages": [ { "name": "alchemy/zippy", @@ -4398,65 +4398,6 @@ "source": "http://cgit.drupalcode.org/inline_entity_form" } }, - { - "name": "drupal/layout_plugin", - "version": "1.0.0-alpha23", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/layout_plugin", - "reference": "8.x-1.0-alpha23" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/layout_plugin-8.x-1.0-alpha23.zip", - "reference": "8.x-1.0-alpha23", - "shasum": "c79992e2f52ac6a7c8dc0706512f2c70fc9f5e11" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.0-alpha23", - "datestamp": "1476269960", - "security-coverage": { - "status": "not-covered", - "message": "Project has not opted into security advisory coverage!" - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "David Snopek", - "homepage": "https://www.drupal.org/user/172527" - }, - { - "name": "Bram Goffings", - "homepage": "https://www.drupal.org/user/266527" - }, - { - "name": "Fredrik Lassen", - "homepage": "https://www.drupal.org/user/243377" - } - ], - "description": "An API module to hold the Drupal 8 plugin manager for layouts.", - "homepage": "https://www.drupal.org/project/layout_plugin", - "keywords": [ - "layout", - "php" - ], - "support": { - "source": "http://cgit.drupalcode.org/layout_plugin" - } - }, { "name": "drupal/link_attributes", "version": "1.0.0", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index c57e12dda7..a840639bee 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -4533,67 +4533,6 @@ "source": "http://cgit.drupalcode.org/inline_entity_form" } }, - { - "name": "drupal/layout_plugin", - "version": "1.0.0-alpha23", - "version_normalized": "1.0.0.0-alpha23", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/layout_plugin", - "reference": "8.x-1.0-alpha23" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/layout_plugin-8.x-1.0-alpha23.zip", - "reference": "8.x-1.0-alpha23", - "shasum": "c79992e2f52ac6a7c8dc0706512f2c70fc9f5e11" - }, - "require": { - "drupal/core": "~8.0" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.0-alpha23", - "datestamp": "1476269960", - "security-coverage": { - "status": "not-covered", - "message": "Project has not opted into security advisory coverage!" - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "David Snopek", - "homepage": "https://www.drupal.org/user/172527" - }, - { - "name": "Bram Goffings", - "homepage": "https://www.drupal.org/user/266527" - }, - { - "name": "Fredrik Lassen", - "homepage": "https://www.drupal.org/user/243377" - } - ], - "description": "An API module to hold the Drupal 8 plugin manager for layouts.", - "homepage": "https://www.drupal.org/project/layout_plugin", - "keywords": [ - "layout", - "php" - ], - "support": { - "source": "http://cgit.drupalcode.org/layout_plugin" - } - }, { "name": "drupal/link_attributes", "version": "1.0.0", diff --git a/web/modules/layout_plugin/LICENSE.txt b/web/modules/layout_plugin/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/layout_plugin/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/layout_plugin/composer.json b/web/modules/layout_plugin/composer.json deleted file mode 100644 index 48566cf233..0000000000 --- a/web/modules/layout_plugin/composer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "drupal/layout_plugin", - "description": "An API module to hold the Drupal 8 plugin manager for layouts.", - "type": "drupal-module", - "license": "GPL-2.0+", - "keywords": ["php", "layout"], - "homepage": "https://www.drupal.org/project/layout_plugin", - "minimum-stability": "dev", - "authors": [ - { - "name": "David Snopek" - }, - { - "name": "Bram Goffings" - }, - { - "name": "Fredrik Lassen" - } - ], - "require": { } -} diff --git a/web/modules/layout_plugin/config/schema/layout_plugin.schema.yml b/web/modules/layout_plugin/config/schema/layout_plugin.schema.yml deleted file mode 100644 index 02bbbe5335..0000000000 --- a/web/modules/layout_plugin/config/schema/layout_plugin.schema.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Schema for layout plugin configuration. - -layout_plugin.settings: - type: mapping - mapping: { } - -layout_plugin.settings.*: - type: layout_plugin.settings - diff --git a/web/modules/layout_plugin/layout_plugin.api.php b/web/modules/layout_plugin/layout_plugin.api.php deleted file mode 100644 index 651b3be6c7..0000000000 --- a/web/modules/layout_plugin/layout_plugin.api.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -/** - * @file - * Hooks provided by the Layout Plugin module. - */ - -/** - * @addtogroup hooks - * @{ - */ - -/** - * Allow modules to alter layout plugin definitions. - * - * @param array[] $definitions - * The array of layout definitions, keyed by plugin ID. - */ -function hook_layout_alter(&$definitions) { - // Remove a layout. - unset($definitions['twocol']); -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/web/modules/layout_plugin/layout_plugin.drush.inc b/web/modules/layout_plugin/layout_plugin.drush.inc deleted file mode 100644 index 1f485cc562..0000000000 --- a/web/modules/layout_plugin/layout_plugin.drush.inc +++ /dev/null @@ -1,85 +0,0 @@ -<?php -/** - * @file - * Drush integration. - */ - -use Drupal\Component\Serialization\Yaml; - -/** - * Implements hook_drush_command(). - */ -function layout_plugin_drush_command() { - $items = array(); - - $items['layout-plugin-list'] = array( - 'description' => 'List layouts.', - 'arguments' => array(), - 'options' => array(), - 'examples' => array( - 'drush layouts-list' => 'List layouts.', - ), - ); - - $items['layout-plugin-region-list'] = array( - 'description' => 'List layout regions.', - 'arguments' => array(), - 'options' => array(), - 'examples' => array( - 'drush layouts-list' => 'List layouts.', - ), - ); - - $items['layout-plugin-region-normalize'] = array( - 'description' => 'Parse regions.', - 'arguments' => array(), - 'options' => array(), - 'examples' => array( - 'drush layouts-list' => 'Parse layouts.', - ), - ); - - return $items; -} - -/** - * Create a basic template and configuration file for new Display Suite layout. - */ -function drush_layout_plugin_list($name = NULL) { - $layoutsManager = \Drupal::service('plugin.manager.layout_plugin'); - /** @var $layoutsManager \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager */ - $plugins = $layoutsManager->getDefinitions(); - foreach ($plugins as $id => $pluginInfo) { - $plugin = $layoutsManager->createInstance($id, array()); - /** @var $plugin \Drupal\layout_plugin\Plugin\Layout\LayoutInterface */ - drush_print(dt('Layout !id: !regions', array('!id' => $id, '!regions' => print_r($plugin->getRegionNames(), TRUE)))); - } - -} - - -/** - * Create a basic template and configuration file for a new Display Suite layout. - */ -function drush_layout_plugin_region_list($name = NULL) { - $layoutsManager = \Drupal::service('plugin.manager.layout_plugin.region'); - /** @var $layoutsManager \Drupal\layout_plugin\Plugin\LayoutRegion\LayoutRegionPluginManager */ - $plugins = $layoutsManager->getDefinitions(); - foreach ($plugins as $id => $pluginInfo) { - $plugin = $layoutsManager->createInstance($id, array()); - /** @var $plugin \Drupal\layout_plugin\Plugin\Layout\LayoutInterface */ - drush_print(dt('Layout region !id could be loaded.', array('!id' => $id))); - } - -} - -function drush_layout_plugin_region_normalize($file = NULL) { - $layouts = Yaml::decode(file_get_contents(drupal_get_path('module', 'layout_plugin_example'). '/layout_plugin_example.layouts.yml')); - foreach ($layouts as $layout_plugin_id => $layout_plugin_info) { - if ($layout_plugin_id === 'koleary') { - $regions = $layout_plugin_info['regions']; - var_dump($layout_plugin_id, $regions); - } - } - -} diff --git a/web/modules/layout_plugin/layout_plugin.info.yml b/web/modules/layout_plugin/layout_plugin.info.yml deleted file mode 100644 index f597229420..0000000000 --- a/web/modules/layout_plugin/layout_plugin.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Layout Plugin -type: module -description: 'Provides a way for modules or themes to register layouts.' -# core: 8.x -package: Layout - -# Information added by Drupal.org packaging script on 2016-10-12 -version: '8.x-1.0-alpha23' -core: '8.x' -project: 'layout_plugin' -datestamp: 1476238141 diff --git a/web/modules/layout_plugin/layout_plugin.module b/web/modules/layout_plugin/layout_plugin.module deleted file mode 100644 index 8b7d1f3b86..0000000000 --- a/web/modules/layout_plugin/layout_plugin.module +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/** - * @file - * Hook implementations for Layout Plugin module. - */ - -use \Drupal\Core\Routing\RouteMatchInterface; -use \Drupal\layout_plugin\Layout; - -/** - * Implements hook_help(); - */ -function layout_plugin_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - case 'help.page.layout_plugin': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('Layout Plugin allows modules or themes to register layouts, and for other modules to list the available layouts and render them. For more information, see the <a href=":layout-plugin-documentation">online documentation for the Layout Plugin module</a>.', [':layout-plugin-documentation' => 'https://www.drupal.org/node/2619128']) . '</p>'; - $output .= '<h3>' . t('Uses') . '</h3>'; - $output .= '<p>' . t('This is an API module which serves as the plugin manager for layouts. API modules provide a common set of routines, protocols, and tools developers use for building specific features into modules for your site. See the Layout Plugin project page for a complete listing of <a href=":layout_plugin">Modules that use Layout Plugin</a>.', [':layout_plugin' => 'https://www.drupal.org/project/layout_plugin']) . '</p>'; - $output .= '<p>' . t('<em>Registering</em> a Layout Plugin - There are several ways to register your layout. For more information of the simplest, most common case and then building up to some of the more advanced techniques, see <a href=":register">How to register layouts with Layout Plugin</a>.', [':layout_plugin' => 'https://www.drupal.org/node/2578731']) . '</p>'; - $output .= '<p>' . t('<em>Rendering</em> a Layout Plugin - To render a layout plugin you first get the layout plugin manager, then list available layouts and instantiate the layout plugin. Rendering is then possible and a configuration display for showing and storing layouts is made available. For more information on rendering layouts, see <a href=":render">How to render layouts using Layout Plugin</a>.', [':layout_plugin' => 'https://www.drupal.org/node/2619168']) . '</p>'; - return $output; - } -} - -/** - * Implements hook_theme(). - */ -function layout_plugin_theme() { - return Layout::layoutPluginManager()->getThemeImplementations(); -} - -/** - * Implements hook_theme_registry_alter(). - */ -function layout_plugin_theme_registry_alter(&$theme_registry) { - Layout::layoutPluginManager()->alterThemeImplementations($theme_registry); -} - -/** - * Implements hook_library_info_build(). - */ -function layout_plugin_library_info_build() { - return Layout::layoutPluginManager()->getLibraryInfo(); -} - -/** - * Prepares variables for layout templates. - * - * We name it with an underscore so if there is ever a template called 'layout' - * that this preprocess function doesn't automatically get picked up. - * - * @param array &$variables - * An associative array containing: - * - element: An associative array containing the properties of the element. - * Properties used: #settings, #layout - */ -function _layout_plugin_preprocess_layout(&$variables) { - $content = $variables['content']; - $variables['settings'] = $content['#settings'] ?: []; - $variables['layout'] = $content['#layout'] ?: []; -} diff --git a/web/modules/layout_plugin/layout_plugin.services.yml b/web/modules/layout_plugin/layout_plugin.services.yml deleted file mode 100644 index 657c0e6e27..0000000000 --- a/web/modules/layout_plugin/layout_plugin.services.yml +++ /dev/null @@ -1,4 +0,0 @@ -services: - plugin.manager.layout_plugin: - class: Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager - arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@theme_handler'] diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/config/schema/layout_plugin_example.schema.yml b/web/modules/layout_plugin/modules/layout_plugin_example/config/schema/layout_plugin_example.schema.yml deleted file mode 100644 index 91df27e729..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/config/schema/layout_plugin_example.schema.yml +++ /dev/null @@ -1,7 +0,0 @@ -layout_plugin.settings.layout_example_test: - type: layout_plugin.settings - label: 'Settings for layout_example_test layout' - mapping: - setting_1: - type: string - label: 'First setting' diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-1col.css b/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-1col.css deleted file mode 100644 index 8b13789179..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-1col.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-2col.css b/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-2col.css deleted file mode 100644 index 1822fe849d..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/css/layout-example-2col.css +++ /dev/null @@ -1,16 +0,0 @@ - -.layout-example-2col .region-left { - float: left; - width: 50%; -} -* html .layout-example-2col .region-left { - width: 49.9%; -} - -.layout-example-2col .region-right { - float: left; - width: 50%; -} -* html .layout-example-2col .region-right { - width: 49.9%; -} diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.info.yml b/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.info.yml deleted file mode 100644 index 5a0eed311a..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.info.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Example Layouts -type: module -description: 'Registers a few example layouts to use for testing or demonstration.' -# core: 8.x -package: Examples -hidden: true -dependencies: - - layout_plugin - -# Information added by Drupal.org packaging script on 2016-10-12 -version: '8.x-1.0-alpha23' -core: '8.x' -project: 'layout_plugin' -datestamp: 1476238141 diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.layouts.yml b/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.layouts.yml deleted file mode 100644 index be9f51ce71..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/layout_plugin_example.layouts.yml +++ /dev/null @@ -1,21 +0,0 @@ -layout_example_1col: - label: 1 Column Layout - category: Examples - template: templates/layout-example-1col - css: css/layout-example-1col.css - regions: - top: - label: Top region - bottom: - label: Bottom region - -layout_example_2col: - label: 2 Column layout - category: Examples - template: templates/layout-example-2col - css: css/layout-example-2col.css - regions: - left: - label: Left region - right: - label: Right region diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/src/Plugin/Layout/LayoutExampleTest.php b/web/modules/layout_plugin/modules/layout_plugin_example/src/Plugin/Layout/LayoutExampleTest.php deleted file mode 100644 index 6753be4c3e..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/src/Plugin/Layout/LayoutExampleTest.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace Drupal\layout_plugin_example\Plugin\Layout; -use Drupal\Core\Form\FormStateInterface; -use Drupal\layout_plugin\Plugin\Layout\LayoutBase; - -/** - * The plugin that handles the default layout template. - * - * @ingroup layout_template_plugins - * - * @Layout( - * id = "layout_example_test", - * label = @Translation("Test layout (with settings)"), - * category = @Translation("Examples"), - * description = @Translation("Test1 sample description"), - * type = "page", - * help = @Translation("Layout"), - * template = "templates/layout-example-test", - * regions = { - * "top" = { - * "label" = @Translation("Top Region"), - * "plugin_id" = "default" - * }, - * "bottom" = { - * "label" = @Translation("Bottom Region"), - * "plugin_id" = "default" - * } - * } - * ) - */ -class LayoutExampleTest extends LayoutBase { - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return parent::defaultConfiguration() + [ - 'setting_1' => 'Default', - ]; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $configuration = $this->getConfiguration(); - $form['setting_1'] = [ - '#type' => 'textfield', - '#title' => 'Blah', - '#default_value' => $configuration['setting_1'], - ]; - return $form; - } - - /** - * @inheritDoc - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - parent::submitConfigurationForm($form, $form_state); - - $this->configuration['setting_1'] = $form_state->getValue('setting_1'); - } - -} diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-1col.html.twig b/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-1col.html.twig deleted file mode 100644 index f47eeceaa4..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-1col.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{# -/** - * @file - * Template for a example 1 column layout. - */ -#} -<div class="layout-example-1col clearfix"> - <div class="region-top"> - {{ content.top }} - </div> - <div class="region-bottom"> - {{ content.bottom }} - </div> -</div> diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-2col.html.twig b/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-2col.html.twig deleted file mode 100644 index 1e8b3dd401..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-2col.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{# -/** - * @file - * Template for a example 2 column layout. - */ -#} -<div class="layout-example-2col clearfix"> - <div class="region-left"> - {{ content.left }} - </div> - <div class="region-right"> - {{ content.right }} - </div> -</div> diff --git a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-test.html.twig b/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-test.html.twig deleted file mode 100644 index 3cabd71d93..0000000000 --- a/web/modules/layout_plugin/modules/layout_plugin_example/templates/layout-example-test.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{# -/** - * @file - * Template for layout_example_test layout. - */ -#} -<div class="layout-example-test clearfix"> - <div> - <span class="setting-1-label">Blah: </span> - {{ settings.setting_1 }} - </div> - <div class="region-top"> - {{ content.top }} - </div> - <div class="region-bottom"> - {{ content.bottom }} - </div> -</div> diff --git a/web/modules/layout_plugin/src/Annotation/Layout.php b/web/modules/layout_plugin/src/Annotation/Layout.php deleted file mode 100644 index 3e07c1332a..0000000000 --- a/web/modules/layout_plugin/src/Annotation/Layout.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Annotation; - -use Drupal\Component\Annotation\Plugin; - -/** - * Defines a Layout annotation object. - * - * Layouts are used to define a list of regions and then output render arrays - * in each of the regions, usually using a template. - * - * Plugin namespace: Plugin\Layout - * - * @see \Drupal\layout_plugin\Plugin\Layout\LayoutInterface - * @see \Drupal\layout_plugin\Plugin\Layout\LayoutBase - * @see \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager - * @see plugin_api - * - * @Annotation - */ -class Layout extends Plugin { - - /** - * The plugin ID. - * - * @var string - */ - public $id; - - /** - * The layout type. - * - * Available options: - * - full: Layout for the whole page. - * - page: Layout for the main page response. - * - partial: A partial layout that is typically used for sub-regions. - * - * @var string - */ - public $type = 'page'; - - /** - * The human-readable name. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $label; - - /** - * An optional description for advanced layouts. - * - * Sometimes layouts are so complex that the name is insufficient to describe - * a layout such that a visually impaired administrator could layout a page - * for a non-visually impaired audience. If specified, it will provide a - * description that is used for accessibility purposes. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $description; - - /** - * The human-readable category. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $category; - - /** - * The theme hook used to render this layout. - * - * If specified, it's assumed that the module or theme registering this layout - * will also register the theme hook with hook_theme() itself. This is - * mutually exclusive with 'template' - you can't specify both. - * - * @var string optional - * - * @see hook_theme() - */ - public $theme; - - /** - * The template file to render this layout (relative to the 'path' given). - * - * If specified, then the layout_plugin module will register the template with - * hook_theme() and the module or theme registering this layout does not need - * to do it. This is mutually exclusive with 'theme' - you can't specify both. - * - * @var string optional - * - * @see hook_theme() - */ - public $template; - - /** - * Path (relative to the module or theme) to resources like icon or template. - * - * @var string optional - */ - public $path; - - /** - * The asset library. - * - * If specified, it's assumed that the module or theme registering this layout - * will also register the library in its *.libraries.yml itself. This is - * mutually exclusive with 'css' - you can't specify both. - * - * @var string optional - */ - public $library; - - /** - * The CSS file. - * - * If specified, then the layout_plugin module will register the library for - * this CSS file automatically and the module or theme registering this layout - * does not need to do it. This is mutually exclusive with 'library' - you - * can't specify both. - * - * @var string optional - * - * @deprecated when moving layout plugin to core - */ - public $css; - - /** - * The path to the preview image (relative to the 'path' given). - * - * @var string optional - */ - public $icon; - - /** - * An associative array of regions in this layout. - * - * The key of the array is the machine name of the region, and the value is - * an associative array with the following keys: - * - label: (string) The human-readable name of the region. - * - * Any remaining keys may have special meaning for the given layout plugin, - * but are undefined here. - * - * @var array - */ - public $regions = array(); - -} diff --git a/web/modules/layout_plugin/src/Layout.php b/web/modules/layout_plugin/src/Layout.php deleted file mode 100644 index 24cf09f80f..0000000000 --- a/web/modules/layout_plugin/src/Layout.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace Drupal\layout_plugin; - -/** - * Class Layout. - */ -class Layout { - - /** - * Returns the plugin manager for the Layout plugin type. - * - * @return \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface - * Layout manager. - */ - public static function layoutPluginManager() { - return \Drupal::service('plugin.manager.layout_plugin'); - } - - /** - * Return all available layout as an options array. - * - * If group_by_category option/parameter passed group the options by - * category. - * - * @param array $params - * (optional) An associative array with the following keys: - * - group_by_category: (bool) If set to TRUE, return an array of arrays - * grouped by the category name; otherwise, return a single-level - * associative array. - * - * @return array - * Layout options, as array. - * - * @deprecated - * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getLayoutOptions(). - */ - public static function getLayoutOptions(array $params = []) { - return static::layoutPluginManager()->getLayoutOptions($params); - } - - /** - * Return theme implementations for layouts that give only a template. - * - * @return array - * An associative array of the same format as returned by hook_theme(). - * - * @see hook_theme() - * - * @deprecated - * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getThemeImplementations(). - */ - public static function getThemeImplementations() { - return static::layoutPluginManager()->getThemeImplementations(); - } - - /** - * Modifies the theme implementations for the layouts that we registered. - * - * @param array &$theme_registry - * An associative array of the same format as passed to hook_theme_registry_alter(). - * - * @see hook_theme_registry_alter() - * - * @deprecated - * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations(). - */ - public static function alterThemeImplementations(array &$theme_registry) { - static::layoutPluginManager()->alterThemeImplementations($theme_registry); - } - - /** - * Return library info for layouts that want to automatically register CSS. - * - * @return array - * An associative array of the same format as returned by - * hook_library_info_build(). - * - * @see hook_library_info_build() - * - * @deprecated - * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations(). - */ - public static function getLibraryInfo() { - return static::layoutPluginManager()->getLibraryInfo(); - } - -} diff --git a/web/modules/layout_plugin/src/Plugin/Layout/LayoutBase.php b/web/modules/layout_plugin/src/Plugin/Layout/LayoutBase.php deleted file mode 100644 index f6b2287403..0000000000 --- a/web/modules/layout_plugin/src/Plugin/Layout/LayoutBase.php +++ /dev/null @@ -1,179 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Plugin\Layout; - -use Drupal\Component\Plugin\ConfigurablePluginInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\PluginBase; -use Drupal\Core\Plugin\PluginFormInterface; - -/** - * Provides a base class for Layout plugins. - */ -abstract class LayoutBase extends PluginBase implements LayoutInterface, ConfigurablePluginInterface, PluginFormInterface { - - /** - * The layout configuration. - * - * @var array - */ - protected $configuration = []; - - /** - * Gets the human-readable name. - * - * @return \Drupal\Core\Annotation\Translation|NULL - * The human-readable name. - */ - public function getLabel() { - return $this->pluginDefinition['label']; - } - - /** - * Gets the optional description for advanced layouts. - * - * @return \Drupal\Core\Annotation\Translation|NULL - * The layout description. - */ - public function getDescription() { - return isset($this->pluginDefinition['description']) ? $this->pluginDefinition['description'] : NULL; - } - - /** - * Gets the human-readable category. - * - * @return \Drupal\Core\Annotation\Translation - * The human-readable category. - */ - public function getCategory() { - return $this->pluginDefinition['category']; - } - - /** - * Gets human-readable list of regions keyed by machine name. - * - * @return \Drupal\Core\Annotation\Translation[] - * An array of human-readable region names keyed by machine name. - */ - public function getRegionNames() { - return $this->pluginDefinition['region_names']; - } - - /** - * Gets information on regions keyed by machine name. - * - * @return array - * An array of information on regions keyed by machine name. - */ - public function getRegionDefinitions() { - return $this->pluginDefinition['regions']; - } - - /** - * Gets the path to resources like icon or template. - * - * @return string|NULL - * The path relative to the Drupal root. - */ - public function getBasePath() { - return isset($this->pluginDefinition['path']) ? $this->pluginDefinition['path'] : NULL; - } - - /** - * Gets the path to the preview image. - * - * This can optionally be used in the user interface to show the layout of - * regions visually. - * - * @return string|NULL - * The path to preview image file. - */ - public function getIconFilename() { - return isset($this->pluginDefinition['icon']) ? $this->pluginDefinition['icon'] : NULL; - } - - /** - * Get the asset library. - * - * @return string|NULL - * The asset library. - */ - public function getLibrary() { - return isset($this->pluginDefinition['library']) ? $this->pluginDefinition['library'] : NULL; - } - - /** - * Gets the theme hook used to render this layout. - * - * @return string|NULL - * Theme hook. - */ - public function getThemeHook() { - return isset($this->pluginDefinition['theme']) ? $this->pluginDefinition['theme'] : NULL; - } - - /** - * {@inheritdoc} - */ - public function build(array $regions) { - $build = array_intersect_key($regions, $this->getRegionDefinitions()); - $build['#layout'] = $this->getPluginDefinition(); - $build['#settings'] = $this->getConfiguration(); - if ($theme = $this->getThemeHook()) { - $build['#theme'] = $theme; - } - if ($library = $this->getLibrary()) { - $build['#attached']['library'][] = $library; - } - return $build; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - } - - /** - * {@inheritdoc} - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - $this->configuration = $form_state->getValues(); - } - - /** - * {@inheritdoc} - */ - public function getConfiguration() { - return array_merge($this->defaultConfiguration(), $this->configuration); - } - - /** - * {@inheritdoc} - */ - public function setConfiguration(array $configuration) { - $this->configuration = $configuration; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return []; - } - - /** - * {@inheritdoc} - */ - public function calculateDependencies() { - return isset($this->configuration['dependencies']) ? $this->configuration['dependencies'] : []; - } - -} diff --git a/web/modules/layout_plugin/src/Plugin/Layout/LayoutDefault.php b/web/modules/layout_plugin/src/Plugin/Layout/LayoutDefault.php deleted file mode 100644 index 462b68d5b6..0000000000 --- a/web/modules/layout_plugin/src/Plugin/Layout/LayoutDefault.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Plugin\Layout; - -/** - * Provides a default class for Layout plugins. - */ -class LayoutDefault extends LayoutBase { - -} diff --git a/web/modules/layout_plugin/src/Plugin/Layout/LayoutInterface.php b/web/modules/layout_plugin/src/Plugin/Layout/LayoutInterface.php deleted file mode 100644 index aae9affea2..0000000000 --- a/web/modules/layout_plugin/src/Plugin/Layout/LayoutInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Plugin\Layout; - -use Drupal\Component\Plugin\DerivativeInspectionInterface; -use Drupal\Component\Plugin\PluginInspectionInterface; - -/** - * Provides an interface for static Layout plugins. - */ -interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface { - - /** - * Build a render array for layout with regions. - * - * @param array $regions - * An associative array keyed by region name, containing render arrays - * representing the content that should be placed in each region. - * - * @return array - * Render array for the layout with regions. - */ - public function build(array $regions); - -} diff --git a/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManager.php b/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManager.php deleted file mode 100644 index 67ac3cbd6f..0000000000 --- a/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManager.php +++ /dev/null @@ -1,258 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Plugin\Layout; - -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Extension\ThemeHandlerInterface; -use Drupal\Core\Plugin\CategorizingPluginManagerTrait; -use Drupal\Core\Plugin\DefaultPluginManager; -use Drupal\Core\Plugin\Discovery\YamlDiscoveryDecorator; - -/** - * Plugin type manager for all layouts. - */ -class LayoutPluginManager extends DefaultPluginManager implements LayoutPluginManagerInterface { - - use CategorizingPluginManagerTrait; - - /** - * The theme handler. - * - * @var \Drupal\Core\Extension\ThemeHandlerInterface - */ - protected $themeHandler; - - /** - * Constructs a LayoutPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations. - * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend - * Cache backend instance to use. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to invoke the alter hook with. - * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler - * The theme handle to invoke the alter hook with. - */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) { - $plugin_interface = 'Drupal\layout_plugin\Plugin\Layout\LayoutInterface'; - $plugin_definition_annotation_name = 'Drupal\layout_plugin\Annotation\Layout'; - parent::__construct("Plugin/Layout", $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name); - $discovery = $this->getDiscovery(); - $this->discovery = new YamlDiscoveryDecorator($discovery, 'layouts', $module_handler->getModuleDirectories() + $theme_handler->getThemeDirectories()); - $this->themeHandler = $theme_handler; - - $this->defaults += array( - 'type' => 'page', - // Used for plugins defined in layouts.yml that do not specify a class - // themselves. - 'class' => 'Drupal\layout_plugin\Plugin\Layout\LayoutDefault', - ); - - $this->setCacheBackend($cache_backend, 'layout'); - $this->alterInfo('layout'); - } - - /** - * {@inheritdoc} - */ - protected function providerExists($provider) { - return $this->moduleHandler->moduleExists($provider) || $this->themeHandler->themeExists($provider); - } - - /** - * {@inheritdoc} - */ - public function processDefinition(&$definition, $plugin_id) { - parent::processDefinition($definition, $plugin_id); - - // Add the module or theme path to the 'path'. - if ($this->moduleHandler->moduleExists($definition['provider'])) { - $definition['provider_type'] = 'module'; - $base_path = $this->moduleHandler->getModule($definition['provider'])->getPath(); - } - elseif ($this->themeHandler->themeExists($definition['provider'])) { - $definition['provider_type'] = 'theme'; - $base_path = $this->themeHandler->getTheme($definition['provider'])->getPath(); - } - else { - $base_path = ''; - } - $definition['path'] = !empty($definition['path']) ? $base_path . '/' . $definition['path'] : $base_path; - - // Add a dependency on the provider of the library. - if (!empty($definition['library'])) { - list ($library_provider, ) = explode('/', $definition['library']); - if ($this->moduleHandler->moduleExists($library_provider)) { - $definition['dependencies'] = ['module' => [$library_provider]]; - } - elseif ($this->themeHandler->themeExists($library_provider)) { - $definition['dependencies'] = ['theme' => [$library_provider]]; - } - } - - // Add the path to the icon filename. - if (!empty($definition['icon'])) { - $definition['icon'] = $definition['path'] . '/' . $definition['icon']; - } - - // If 'template' is set, then we'll derive 'template_path' and 'theme'. - if (!empty($definition['template'])) { - $template_parts = explode('/', $definition['template']); - - $definition['template'] = array_pop($template_parts); - $definition['theme'] = strtr($definition['template'], '-', '_'); - $definition['template_path'] = $definition['path']; - if (count($template_parts) > 0) { - $definition['template_path'] .= '/' . implode('/', $template_parts); - } - } - - // If 'css' is set, then we'll derive 'library'. - if (!empty($definition['css'])) { - $definition['css'] = $definition['path'] . '/' . $definition['css']; - $definition['library'] = 'layout_plugin/' . $plugin_id; - } - - // Generate the 'region_names' key from the 'regions' key. - $definition['region_names'] = array(); - if (!empty($definition['regions']) && is_array($definition['regions'])) { - foreach ($definition['regions'] as $region_id => $region_definition) { - $definition['region_names'][$region_id] = $region_definition['label']; - } - } - } - - /** - * {@inheritdoc} - */ - public function getLayoutOptions(array $params = []) { - $group_by_category = !empty($params['group_by_category']); - $plugins = $group_by_category ? $this->getGroupedDefinitions() : ['default' => $this->getDefinitions()]; - $categories = $group_by_category ? $this->getCategories() : ['default']; - - // Go through each category, sort it, and get just the labels out. - $options = array(); - foreach ($categories as $category) { - // Convert from a translation to a real string. - $category = (string) $category; - - // Sort the category. - $plugins[$category] = $this->getSortedDefinitions($plugins[$category]); - - // Put only the label in the options array. - foreach ($plugins[$category] as $id => $plugin) { - $options[$category][$id] = $plugin['label']; - } - } - - return $group_by_category ? $options : $options['default']; - } - - /** - * {@inheritdoc} - */ - public function getThemeImplementations() { - $plugins = $this->getDefinitions(); - - $theme_registry = []; - foreach ($plugins as $id => $definition) { - if (!empty($definition['template']) && !empty($definition['theme'])) { - $theme_registry[$definition['theme']] = [ - 'render element' => 'content', - 'template' => $definition['template'], - 'path' => $definition['template_path'], - ]; - } - } - - return $theme_registry; - } - - /** - * {@inheritdoc} - */ - public function alterThemeImplementations(array &$theme_registry) { - $plugins = $this->getDefinitions(); - - // Find all the theme hooks which are for automatically registered templates - // (we ignore manually set theme hooks because we don't know how they were - // registered). - $layout_theme_hooks = []; - foreach ($plugins as $id => $definition) { - if (!empty($definition['template']) && !empty($definition['theme']) && isset($theme_registry[$definition['theme']])) { - $layout_theme_hooks[] = $definition['theme']; - } - } - - // Go through the theme registry looking for our theme hooks and any - // suggestions based on them. - foreach ($theme_registry as $theme_hook => &$info) { - if (in_array($theme_hook, $layout_theme_hooks) || (!empty($info['base hook']) && in_array($info['base hook'], $layout_theme_hooks))) { - // If 'template_preprocess' is included, we want to put our preprocess - // after to not mess up the expectation that 'template_process' always - // runs first. - if (($index = array_search('template_preprocess', $info['preprocess functions'])) !== FALSE) { - $index++; - } - else { - // Otherwise, put our preprocess function first. - $index = 0; - } - - array_splice($info['preprocess functions'], $index, 0, '_layout_plugin_preprocess_layout'); - } - } - } - - /** - * Gets the version of the given provider. - * - * Wraps system_get_info() so that we can mock it in our tests. - * - * @param string $provider_type - * The provider type (ex. module or theme). - * @param string $provider - * The name of the provider. - * - * @return string - * The version string for the provider or 'VERSION' if it can't be found. - */ - protected function getProviderVersion($provider_type, $provider) { - $info = system_get_info($provider_type, $provider); - return !empty($info['version']) ? $info['version'] : 'VERSION'; - } - - /** - * {@inheritdoc} - */ - public function getLibraryInfo() { - $plugins = $this->getDefinitions(); - - $library_info = []; - foreach ($plugins as $id => $definition) { - if (!empty($definition['css']) && !empty($definition['library'])) { - list ($library_module, $library_name) = explode('/', $definition['library']); - - // Make sure the library is from layout_plugin. - if ($library_module != 'layout_plugin') { - continue; - } - - $library_info[$library_name] = [ - 'version' => $this->getProviderVersion($definition['provider_type'], $definition['provider']), - 'css' => [ - 'theme' => [ - '/' . $definition['css'] => [], - ], - ], - ]; - } - } - - return $library_info; - } - -} diff --git a/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManagerInterface.php b/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManagerInterface.php deleted file mode 100644 index 46f8208376..0000000000 --- a/web/modules/layout_plugin/src/Plugin/Layout/LayoutPluginManagerInterface.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -namespace Drupal\layout_plugin\Plugin\Layout; - -use Drupal\Component\Plugin\CategorizingPluginManagerInterface; - -/** - * Provides an interface for the discovery and instantiation of layout plugins. - */ -interface LayoutPluginManagerInterface extends CategorizingPluginManagerInterface { - - /** - * Get all available layouts as an options array. - * - * If group_by_category option/parameter passed group the options by - * category. - * - * @param array $params - * (optional) An associative array with the following keys: - * - group_by_category: (bool) If set to TRUE, return an array of arrays - * grouped by the category name; otherwise, return a single-level - * associative array. - * - * @return array - * Layout options, as array. - */ - public function getLayoutOptions(array $params = []); - - /** - * Get theme implementations for layouts that give only a template. - * - * @return array - * An associative array of the same format as returned by hook_theme(). - * - * @see hook_theme() - */ - public function getThemeImplementations(); - - /** - * Modifies the theme implementations for the layouts that we registered. - * - * @param array &$theme_registry - * An associative array of the same format as passed to hook_theme_registry_alter(). - * - * @see hook_theme_registry_alter() - */ - public function alterThemeImplementations(array &$theme_registry); - - /** - * Get library info for layouts that want to automatically register CSS. - * - * @return array - * An associative array of the same format as returned by - * hook_library_info_build(). - * - * @see hook_library_info_build() - * - * @deprecated when moving layout plugin to core - */ - public function getLibraryInfo(); - -} diff --git a/web/modules/layout_plugin/tests/modules/layout_test/config/schema/layout_test.schema.yml b/web/modules/layout_plugin/tests/modules/layout_test/config/schema/layout_test.schema.yml deleted file mode 100644 index 521faafae1..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/config/schema/layout_test.schema.yml +++ /dev/null @@ -1,7 +0,0 @@ -layout_plugin.settings.layout_test_plugin: - type: layout_plugin.settings - label: 'Layout test plugin settings' - mapping: - setting_1: - type: string - label: 'Setting 1' diff --git a/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-1col.css b/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-1col.css deleted file mode 100644 index 8b13789179..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-1col.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-2col.css b/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-2col.css deleted file mode 100644 index d5c05b9eeb..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/css/layout-test-2col.css +++ /dev/null @@ -1,16 +0,0 @@ - -.layout-example-2col .region-left { - float: left; - width: 50%; -} -* html .layout-example-2col .region-left { - width: 49.9%; -} - -.layout-example-2col .region-right { - float: left; - width: 50%; -} -* html .layout-example-2col .region-right { - width: 49.9%; -} diff --git a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.info.yml b/web/modules/layout_plugin/tests/modules/layout_test/layout_test.info.yml deleted file mode 100644 index d5b62cbe5e..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.info.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Layout test' -type: module -description: 'Support module for testing layouts.' -package: Testing -# version: VERSION -# core: 8.x - -# Information added by Drupal.org packaging script on 2016-10-12 -version: '8.x-1.0-alpha23' -core: '8.x' -project: 'layout_plugin' -datestamp: 1476238141 diff --git a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.layouts.yml b/web/modules/layout_plugin/tests/modules/layout_test/layout_test.layouts.yml deleted file mode 100644 index 8372de277c..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.layouts.yml +++ /dev/null @@ -1,21 +0,0 @@ -layout_test_1col: - label: 1 column layout - category: Layout test - template: templates/layout-test-1col - library: layout_test/layout_test_1col - regions: - top: - label: Top region - bottom: - label: Bottom region - -layout_test_2col: - label: 2 column layout - category: Layout test - template: templates/layout-test-2col - library: layout_test/layout_test_2col - regions: - left: - label: Left region - right: - label: Right region diff --git a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.libraries.yml b/web/modules/layout_plugin/tests/modules/layout_test/layout_test.libraries.yml deleted file mode 100644 index f2bfb5a9bd..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/layout_test.libraries.yml +++ /dev/null @@ -1,11 +0,0 @@ -layout_test_1col: - version: 1.x - css: - theme: - css/layout-test-1col.css: {} - -layout_test_2col: - version: 1.x - css: - theme: - css/layout-test-2col.css: {} diff --git a/web/modules/layout_plugin/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php b/web/modules/layout_plugin/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php deleted file mode 100644 index 7e7d1b4162..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/src/Plugin/Layout/LayoutTestPlugin.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Drupal\layout_test\Plugin\Layout; - -use Drupal\Core\Form\FormStateInterface; -use Drupal\layout_plugin\Plugin\Layout\LayoutBase; - -/** - * The plugin that handles the default layout template. - * - * @ingroup layout_template_plugins - * - * @Layout( - * id = "layout_test_plugin", - * label = @Translation("Layout plugin (with settings)"), - * category = @Translation("Layout test"), - * description = @Translation("Test layout"), - * template = "templates/layout-test-plugin", - * regions = { - * "main" = { - * "label" = @Translation("Main Region") - * } - * } - * ) - */ -class LayoutTestPlugin extends LayoutBase { - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return parent::defaultConfiguration() + [ - 'setting_1' => 'Default', - ]; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $configuration = $this->getConfiguration(); - $form['setting_1'] = [ - '#type' => 'textfield', - '#title' => 'Blah', - '#default_value' => $configuration['setting_1'], - ]; - return $form; - } - - /** - * @inheritDoc - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - parent::submitConfigurationForm($form, $form_state); - - $this->configuration['setting_1'] = $form_state->getValue('setting_1'); - } - -} diff --git a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-1col.html.twig b/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-1col.html.twig deleted file mode 100644 index e7a7eb5baa..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-1col.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{# -/** - * @file - * Template for an example 1 column layout. - */ -#} -<div class="layout-example-1col clearfix"> - <div class="region-top"> - {{ content.top }} - </div> - <div class="region-bottom"> - {{ content.bottom }} - </div> -</div> diff --git a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-2col.html.twig b/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-2col.html.twig deleted file mode 100644 index 11433ee99c..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-2col.html.twig +++ /dev/null @@ -1,14 +0,0 @@ -{# -/** - * @file - * Template for an example 2 column layout. - */ -#} -<div class="layout-example-2col clearfix"> - <div class="region-left"> - {{ content.left }} - </div> - <div class="region-right"> - {{ content.right }} - </div> -</div> diff --git a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-plugin.html.twig b/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-plugin.html.twig deleted file mode 100644 index e49942c4cb..0000000000 --- a/web/modules/layout_plugin/tests/modules/layout_test/templates/layout-test-plugin.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{# -/** - * @file - * Template for layout_test_plugin layout. - */ -#} -<div class="layout-test-plugin clearfix"> - <div> - <span class="setting-1-label">Blah: </span> - {{ settings.setting_1 }} - </div> - <div class="region-main"> - {{ content.main }} - </div> -</div> diff --git a/web/modules/layout_plugin/tests/src/Kernel/LayoutTest.php b/web/modules/layout_plugin/tests/src/Kernel/LayoutTest.php deleted file mode 100644 index eab53ff2ed..0000000000 --- a/web/modules/layout_plugin/tests/src/Kernel/LayoutTest.php +++ /dev/null @@ -1,141 +0,0 @@ -<?php - -namespace Drupal\Tests\layout_plugin\Kernel; - -use Drupal\KernelTests\KernelTestBase; - -/** - * Tests Layout functionality. - * - * @group LayoutPlugin - */ -class LayoutTest extends KernelTestBase { - - /** - * {@inheritdoc} - */ - public static $modules = ['system', 'layout_plugin', 'layout_test']; - - /** - * The layout plugin manager. - * - * @var \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface - */ - protected $layoutManager; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - $this->layoutManager = $this->container->get('plugin.manager.layout_plugin'); - } - - /** - * Test listing the available layouts. - */ - public function testLayoutDefinitions() { - $expected_layouts = [ - 'layout_test_1col', - 'layout_test_2col', - 'layout_test_plugin', - ]; - $this->assertEquals($expected_layouts, array_keys($this->layoutManager->getDefinitions())); - } - - /** - * Test rendering a layout. - * - * @dataProvider renderLayoutData - */ - public function testRenderLayout($layout_id, $config, $regions, $html) { - /** @var \Drupal\layout_plugin\Plugin\Layout\LayoutInterface $layout */ - $layout = $this->layoutManager->createInstance($layout_id, $config); - $built = $layout->build($regions); - $this->render($built); - $this->assertRaw($html); - } - - /** - * Data provider for testRenderLayout(). - */ - public function renderLayoutData() { - $data = [ - 'layout_test_1col' => [ - 'layout_test_1col', - [], - [ - 'top' => [ - '#markup' => 'This is the top', - ], - 'bottom' => [ - '#markup' => 'This is the bottom', - ], - ], - ], - - 'layout_test_2col' => [ - 'layout_test_2col', - [], - [ - 'left' => [ - '#markup' => 'This is the left', - ], - 'right' => [ - '#markup' => 'This is the right', - ], - ], - ], - - 'layout_test_plugin' => [ - 'layout_test_plugin', - [ - 'setting_1' => 'Config value' - ], - [ - 'main' => [ - '#markup' => 'Main region', - ], - ] - ], - ]; - - $data['layout_test_1col'][] = <<<'EOD' -<div class="layout-example-1col clearfix"> - <div class="region-top"> - This is the top - </div> - <div class="region-bottom"> - This is the bottom - </div> -</div> -EOD; - - $data['layout_test_2col'][] = <<<'EOD' -<div class="layout-example-2col clearfix"> - <div class="region-left"> - This is the left - </div> - <div class="region-right"> - This is the right - </div> -</div> -EOD; - - $data['layout_test_plugin'][] = <<<'EOD' -<div class="layout-test-plugin clearfix"> - <div> - <span class="setting-1-label">Blah: </span> - Config value - </div> - <div class="region-main"> - Main region - </div> -</div> -EOD; - - return $data; - } - -} diff --git a/web/modules/layout_plugin/tests/src/Unit/PluginManagerTest.php b/web/modules/layout_plugin/tests/src/Unit/PluginManagerTest.php deleted file mode 100644 index fee5433df5..0000000000 --- a/web/modules/layout_plugin/tests/src/Unit/PluginManagerTest.php +++ /dev/null @@ -1,368 +0,0 @@ -<?php - -namespace Drupal\Tests\layout_plugin\Unit; - -use Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager; -use Drupal\Tests\UnitTestCase; - -/** - * Tests the LayoutPluginManager. - * - * @coversDefaultClass \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager - * - * @group LayoutPlugin - */ -class PluginManagerTest extends UnitTestCase { - - /** - * Test processDefinition. - * - * @covers ::processDefinition - */ - public function testProcessDefinition() { - $namespaces = new \ArrayObject(); - $namespaces['Drupal\layout_plugin_test'] = $this->root . '/modules/layout_plugin_test/src'; - - $cache_backend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); - - $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); - $module_handler->method('getModuleDirectories')->willReturn(array()); - $module_handler->method('moduleExists')->willReturn(TRUE); - $extension = $this->getMockBuilder('Drupal\Core\Extension\Extension') - ->disableOriginalConstructor() - ->getMock(); - $extension->method('getPath')->willReturn('modules/layout_plugin_test'); - $module_handler->method('getModule')->willReturn($extension); - - $theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface'); - $theme_handler->method('getThemeDirectories')->willReturn(array()); - - $plugin_manager = new LayoutPluginManager($namespaces, $cache_backend, $module_handler, $theme_handler); - - // A simple definition with only the required keys. - $definition = [ - 'label' => 'Simple layout', - 'category' => 'Test layouts', - 'theme' => 'simple_layout', - 'provider' => 'layout_plugin_test', - 'regions' => [ - 'first' => ['label' => 'First region'], - 'second' => ['label' => 'Second region'], - ], - ]; - $plugin_manager->processDefinition($definition, 'simple_layout'); - $this->assertEquals('modules/layout_plugin_test', $definition['path']); - $this->assertEquals([ - 'first' => 'First region', - 'second' => 'Second region' - ], $definition['region_names']); - - // A more complex definition. - $definition = [ - 'label' => 'Complex layout', - 'category' => 'Test layouts', - 'template' => 'complex-layout', - 'library' => 'library_module/library_name', - 'provider' => 'layout_plugin_test', - 'path' => 'layout/complex', - 'icon' => 'complex-layout.png', - 'regions' => [ - 'first' => ['label' => 'First region'], - 'second' => ['label' => 'Second region'], - ], - ]; - $plugin_manager->processDefinition($definition, 'complex_layout'); - $this->assertEquals('modules/layout_plugin_test/layout/complex', $definition['path']); - $this->assertEquals('modules/layout_plugin_test/layout/complex', $definition['template_path']); - $this->assertEquals('modules/layout_plugin_test/layout/complex/complex-layout.png', $definition['icon']); - $this->assertEquals('complex_layout', $definition['theme']); - $this->assertEquals(['module' => ['library_module']], $definition['dependencies']); - - // A layout with a template path. - $definition = [ - 'label' => 'Split layout', - 'category' => 'Test layouts', - 'template' => 'templates/split-layout', - 'provider' => 'layout_plugin_test', - 'path' => 'layouts', - 'icon' => 'images/split-layout.png', - 'regions' => [ - 'first' => ['label' => 'First region'], - 'second' => ['label' => 'Second region'], - ], - ]; - $plugin_manager->processDefinition($definition, 'split_layout'); - $this->assertEquals('modules/layout_plugin_test/layouts', $definition['path']); - $this->assertEquals('modules/layout_plugin_test/layouts/templates', $definition['template_path']); - $this->assertEquals('modules/layout_plugin_test/layouts/images/split-layout.png', $definition['icon']); - $this->assertEquals('split_layout', $definition['theme']); - - // A layout with an auto-registered library. - $definition = [ - 'label' => 'Auto library', - 'category' => 'Test layouts', - 'theme' => 'auto_library', - 'provider' => 'layout_plugin_test', - 'path' => 'layouts/auto_library', - 'css' => 'css/auto-library.css', - 'regions' => [ - 'first' => ['label' => 'First region'], - 'second' => ['label' => 'Second region'], - ], - ]; - $plugin_manager->processDefinition($definition, 'auto_library'); - $this->assertEquals('modules/layout_plugin_test/layouts/auto_library/css/auto-library.css', $definition['css']); - $this->assertEquals('layout_plugin/auto_library', $definition['library']); - } - - /** - * Test getting layout options. - * - * @covers ::getLayoutOptions - */ - public function testGetLayoutOptions() { - /** @var LayoutPluginManager|\PHPUnit_Framework_MockObject_MockBuilder $layout_manager */ - $layout_manager = $this->getMockBuilder('Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager') - ->disableOriginalConstructor() - ->setMethods(['getDefinitions']) - ->getMock(); - - $layout_manager->method('getDefinitions') - ->willReturn([ - 'simple_layout' => [ - 'label' => 'Simple layout', - 'category' => 'Test layouts', - ], - 'complex_layout' => [ - 'label' => 'Complex layout', - 'category' => 'Test layouts', - ], - ]); - - $options = $layout_manager->getLayoutOptions(); - $this->assertEquals([ - 'simple_layout' => 'Simple layout', - 'complex_layout' => 'Complex layout', - ], $options); - - $options = $layout_manager->getLayoutOptions(array('group_by_category' => TRUE)); - $this->assertEquals([ - 'Test layouts' => [ - 'simple_layout' => 'Simple layout', - 'complex_layout' => 'Complex layout', - ], - ], $options); - } - - /** - * Tests layout theme implementations. - * - * @covers ::getThemeImplementations - */ - public function testGetThemeImplementations() { - /** @var LayoutPluginManager|\PHPUnit_Framework_MockObject_MockBuilder $layout_manager */ - $layout_manager = $this->getMockBuilder('Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager') - ->disableOriginalConstructor() - ->setMethods(['getDefinitions']) - ->getMock(); - - $layout_manager->method('getDefinitions') - ->willReturn([ - // Should get template registered automatically. - 'simple_layout' => [ - 'path' => 'modules/layout_plugin_test', - 'template_path' => 'modules/layout_plugin_test/templates', - 'template' => 'simple-layout', - 'theme' => 'simple_layout', - ], - // Shouldn't get registered automatically. - 'complex_layout' => [ - 'path' => 'modules/layout_plugin_test', - 'theme' => 'complex_layout', - ], - ]); - - $theme_registry = $layout_manager->getThemeImplementations(); - $this->assertEquals([ - 'simple_layout' => [ - 'render element' => 'content', - 'template' => 'simple-layout', - 'path' => 'modules/layout_plugin_test/templates', - ], - ], $theme_registry); - } - - /** - * Tests layout theme implementations. - * - * @covers ::alterThemeImplementations - */ - public function testAlterThemeImplementations() { - /** @var LayoutPluginManager|\PHPUnit_Framework_MockObject_MockBuilder $layout_manager */ - $layout_manager = $this->getMockBuilder('Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager') - ->disableOriginalConstructor() - ->setMethods(['getDefinitions']) - ->getMock(); - - $layout_manager->method('getDefinitions') - ->willReturn([ - 'simple_layout' => [ - 'template' => 'simple-layout', - 'theme' => 'simple_layout', - ], - 'no_template_preprocess' => [ - 'template' => 'no-template-preprocess', - 'theme' => 'no_template_preprocess', - ], - 'only_template_preprocess' => [ - 'template' => 'only-template-preprocess', - 'theme' => 'only_template_preprocess', - ], - // If the user registered the theme hook themselves, then we don't - // want to add our preprocess function (because we're not totally sure - // how it'll work). - 'complex_layout' => [ - 'theme' => 'complex_layout', - ], - ]); - - $theme_registry = [ - 'other_theme_hook' => [ - 'preprocess functions' => [ - 'template_preprocess_other_theme_hook' - ], - ], - 'simple_layout' => [ - 'preprocess functions' => [ - 'template_preprocess', - 'template_preprocess_simple_layout' - ], - ], - 'simple_layout__suggestion_template' => [ - 'base hook' => 'simple_layout', - 'preprocess functions' => [ - 'template_preprocess', - 'template_preprocess_simple_layout' - ], - ], - // Make sure our alter still works if there is no 'template_preprocess'. - 'no_template_preprocess' => [ - 'preprocess functions' => [ - 'template_preprocess_no_template_preprocess' - ], - ], - // Make sure our alter still works if there's only 'template_preprocess'. - 'only_template_preprocess' => [ - 'preprocess functions' => [ - 'template_preprocess', - ], - ], - 'complex_layout' => [ - 'preprocess functions' => [ - 'template_preprocess_complex_layout', - ], - ], - ]; - - $layout_manager->alterThemeImplementations($theme_registry); - $this->assertEquals([ - 'other_theme_hook' => [ - 'preprocess functions' => [ - 'template_preprocess_other_theme_hook' - ], - ], - 'simple_layout' => [ - 'preprocess functions' => [ - 'template_preprocess', - '_layout_plugin_preprocess_layout', - 'template_preprocess_simple_layout' - ], - ], - 'simple_layout__suggestion_template' => [ - 'base hook' => 'simple_layout', - 'preprocess functions' => [ - 'template_preprocess', - '_layout_plugin_preprocess_layout', - 'template_preprocess_simple_layout' - ], - ], - 'no_template_preprocess' => [ - 'preprocess functions' => [ - '_layout_plugin_preprocess_layout', - 'template_preprocess_no_template_preprocess' - ], - ], - 'only_template_preprocess' => [ - 'preprocess functions' => [ - 'template_preprocess', - '_layout_plugin_preprocess_layout', - ], - ], - 'complex_layout' => [ - 'preprocess functions' => [ - 'template_preprocess_complex_layout', - ], - ], - ], $theme_registry); - } - - /** - * Tests layout plugin library info. - * - * @covers ::getLibraryInfo - */ - public function testGetLibraryInfo() { - /** @var \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager|\PHPUnit_Framework_MockObject_MockObject $layout_manager */ - $layout_manager = $this->getMockBuilder('Drupal\layout_plugin\Plugin\Layout\LayoutPluginManager') - ->disableOriginalConstructor() - ->setMethods(['getDefinitions', 'getProviderVersion']) - ->getMock(); - - $layout_manager->method('getDefinitions') - ->willReturn([ - // Should get template registered automatically. - 'simple_layout' => [ - 'css' => 'modules/layout_plugin_test/layouts/simple_layout/simple-layout.css', - 'library' => 'layout_plugin/simple_layout', - 'provider_type' => 'module', - 'provider' => 'layout_plugin_test', - ], - 'theme_layout' => [ - 'css' => 'themes/theme_with_layout/layouts/theme_layout/theme-layout.css', - 'library' => 'layout_plugin/theme_layout', - 'provider_type' => 'theme', - 'provider' => 'theme_with_layout', - ], - 'complex_layout' => [ - 'library' => 'layout_plugin_test/complex_layout', - ], - ]); - - $layout_manager->method('getProviderVersion') - ->willReturnMap([ - ['module', 'layout_plugin_test', '1.2.3'], - ['theme', 'theme_with_layout', '2.3.4'], - ]); - - $library_info = $layout_manager->getLibraryInfo(); - $this->assertEquals([ - 'simple_layout' => [ - 'version' => '1.2.3', - 'css' => [ - 'theme' => [ - '/modules/layout_plugin_test/layouts/simple_layout/simple-layout.css' => [], - ], - ], - ], - 'theme_layout' => [ - 'version' => '2.3.4', - 'css' => [ - 'theme' => [ - '/themes/theme_with_layout/layouts/theme_layout/theme-layout.css' => [], - ], - ], - ], - ], $library_info); - } - -} -- GitLab