From e218917148f4479be270de28843da8e964a9e461 Mon Sep 17 00:00:00 2001 From: bcweaver <brianweaver@gmail.com> Date: Tue, 23 Oct 2018 16:49:06 -0400 Subject: [PATCH] Add 'features' module to composer.json and update it to the latest version --- composer.json | 1 + composer.lock | 136 ++++++- vendor/composer/installed.json | 132 +++++++ .../{LICENSE.txt~HEAD => LICENSE.txt} | 0 web/modules/features/LICENSE.txt~master | 339 ------------------ web/modules/features/composer.json | 9 +- .../features/drush/features.drush8.inc | 259 ++++++------- web/modules/features/features.info.yml | 10 +- web/modules/features/features.module | 8 +- .../features_ui/css/features_ui.admin.css | 9 +- .../modules/features_ui/features_ui.admin.inc | 72 ++-- .../modules/features_ui/features_ui.info.yml | 8 +- .../modules/features_ui/features_ui.module | 26 +- .../src/Controller/FeaturesUIController.php | 14 +- .../src/Form/AssignmentAlterForm.php | 12 +- .../src/Form/AssignmentConfigureForm.php | 142 ++++---- .../src/Form/AssignmentExcludeForm.php | 60 ++-- .../src/Form/AssignmentFormBase.php | 42 +-- .../src/Form/AssignmentProfileForm.php | 16 +- .../features_ui/src/Form/FeaturesDiffForm.php | 112 +++--- .../features_ui/src/Form/FeaturesEditForm.php | 270 +++++++------- .../src/Form/FeaturesExportForm.php | 182 +++++----- .../features_ui/src/Tests/FeaturesUITest.php | 2 +- .../src/Commands/FeaturesCommands.php | 5 +- .../src/Controller/FeaturesController.php | 2 +- .../features/src/Entity/FeaturesBundle.php | 6 +- web/modules/features/src/FeaturesAssigner.php | 12 +- .../src/FeaturesConfigDependencyManager.php | 6 +- .../features/src/FeaturesConfigInstaller.php | 2 +- .../FeaturesExtensionStoragesByDirectory.php | 24 ++ ...sExtensionStoragesByDirectoryInterface.php | 26 ++ .../src/FeaturesGenerationMethodBase.php | 2 +- .../src/FeaturesGenerationMethodInterface.php | 4 +- .../features/src/FeaturesGenerator.php | 10 +- .../src/FeaturesGeneratorInterface.php | 4 +- .../features/src/FeaturesInstallStorage.php | 8 +- web/modules/features/src/FeaturesManager.php | 43 +-- .../features/src/FeaturesManagerInterface.php | 4 +- web/modules/features/src/Package.php | 2 +- .../FeaturesAssignmentBaseType.php | 6 +- .../FeaturesAssignmentProfile.php | 2 +- .../FeaturesGenerationArchive.php | 2 +- .../FeaturesGenerationWrite.php | 2 +- .../test_feature/test_feature.info.yml | 6 +- .../test_mybundle_core.info.yml | 6 +- .../tests/src/Kernel/FeaturesAssignerTest.php | 11 +- 46 files changed, 1023 insertions(+), 1033 deletions(-) rename web/modules/features/{LICENSE.txt~HEAD => LICENSE.txt} (100%) delete mode 100644 web/modules/features/LICENSE.txt~master create mode 100644 web/modules/features/src/FeaturesExtensionStoragesByDirectory.php create mode 100644 web/modules/features/src/FeaturesExtensionStoragesByDirectoryInterface.php diff --git a/composer.json b/composer.json index 7aedba1b5b..e9bc421b59 100644 --- a/composer.json +++ b/composer.json @@ -100,6 +100,7 @@ "drupal/entity_reference_revisions": "1.3", "drupal/eva": "1.1", "drupal/externalauth": "1.0", + "drupal/features": "3.8", "drupal/field_collection": "1.0-alpha1", "drupal/field_group": "1.0-rc6", "drupal/field_permissions": "1.0-beta1", diff --git a/composer.lock b/composer.lock index c4a782c6a1..2a45dfbbd9 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": "44a4caf7dab80aa7a8dc0bbbbb7da3db", + "content-hash": "993ba644c62fba2626739141c08dbbd1", "packages": [ { "name": "alchemy/zippy", @@ -1503,7 +1503,8 @@ "homepage": "https://www.drupal.org/project/adminimal_theme", "support": { "source": "http://cgit.drupalcode.org/adminimal_theme" - } + }, + "time": "2017-07-08T17:49:05+00:00" }, { "name": "drupal/administerusersbyrole", @@ -2012,6 +2013,57 @@ "source": "http://cgit.drupalcode.org/config_installer" } }, + { + "name": "drupal/config_update", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://git.drupal.org/project/config_update", + "reference": "8.x-1.5" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/config_update-8.x-1.5.zip", + "reference": "8.x-1.5", + "shasum": "2f7ae5f90b1c0ab8edf84680d2651e81fab6a126" + }, + "require": { + "drupal/core": "*" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + }, + "drupal": { + "version": "8.x-1.5", + "datestamp": "1512587912", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "jhodgdon", + "homepage": "https://www.drupal.org/user/155601" + }, + { + "name": "nedjo", + "homepage": "https://www.drupal.org/user/4481" + } + ], + "description": "Provides basic revert and update functionality for other modules", + "homepage": "https://www.drupal.org/project/config_update", + "support": { + "source": "http://cgit.drupalcode.org/config_update" + } + }, { "name": "drupal/console", "version": "1.8.0", @@ -3719,6 +3771,83 @@ "source": "http://cgit.drupalcode.org/externalauth" } }, + { + "name": "drupal/features", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://git.drupal.org/project/features", + "reference": "8.x-3.8" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/features-8.x-3.8.zip", + "reference": "8.x-3.8", + "shasum": "15cebd00e38d63c0d946682e76327a03499c27be" + }, + "require": { + "drupal/config_update": "^1.4", + "drupal/core": "*" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev" + }, + "drupal": { + "version": "8.x-3.8", + "datestamp": "1536512284", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "dawehner", + "homepage": "https://www.drupal.org/user/99340" + }, + { + "name": "e2thex", + "homepage": "https://www.drupal.org/user/189123" + }, + { + "name": "febbraro", + "homepage": "https://www.drupal.org/user/43670" + }, + { + "name": "jmiccolis", + "homepage": "https://www.drupal.org/user/31731" + }, + { + "name": "mpotter", + "homepage": "https://www.drupal.org/user/616192" + }, + { + "name": "nedjo", + "homepage": "https://www.drupal.org/user/4481" + }, + { + "name": "tim.plunkett", + "homepage": "https://www.drupal.org/user/241634" + } + ], + "description": "Enables administrators to package configuration into modules", + "homepage": "https://www.drupal.org/project/features", + "support": { + "source": "http://cgit.drupalcode.org/features" + } + }, { "name": "drupal/field_collection", "version": "1.0.0-alpha1", @@ -6594,7 +6723,8 @@ ], "support": { "source": "http://cgit.drupalcode.org/views_bootstrap" - } + }, + "time": "2018-05-17T13:28:26+00:00" }, { "name": "drupal/views_bulk_operations", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 510874ca5d..07477c2492 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2078,6 +2078,59 @@ "source": "http://cgit.drupalcode.org/config_installer" } }, + { + "name": "drupal/config_update", + "version": "1.5.0", + "version_normalized": "1.5.0.0", + "source": { + "type": "git", + "url": "https://git.drupal.org/project/config_update", + "reference": "8.x-1.5" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/config_update-8.x-1.5.zip", + "reference": "8.x-1.5", + "shasum": "2f7ae5f90b1c0ab8edf84680d2651e81fab6a126" + }, + "require": { + "drupal/core": "*" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + }, + "drupal": { + "version": "8.x-1.5", + "datestamp": "1512587912", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "jhodgdon", + "homepage": "https://www.drupal.org/user/155601" + }, + { + "name": "nedjo", + "homepage": "https://www.drupal.org/user/4481" + } + ], + "description": "Provides basic revert and update functionality for other modules", + "homepage": "https://www.drupal.org/project/config_update", + "support": { + "source": "http://cgit.drupalcode.org/config_update" + } + }, { "name": "drupal/console", "version": "1.8.0", @@ -3829,6 +3882,85 @@ "source": "http://cgit.drupalcode.org/externalauth" } }, + { + "name": "drupal/features", + "version": "3.8.0", + "version_normalized": "3.8.0.0", + "source": { + "type": "git", + "url": "https://git.drupal.org/project/features", + "reference": "8.x-3.8" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/features-8.x-3.8.zip", + "reference": "8.x-3.8", + "shasum": "15cebd00e38d63c0d946682e76327a03499c27be" + }, + "require": { + "drupal/config_update": "^1.4", + "drupal/core": "*" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-3.x": "3.x-dev" + }, + "drupal": { + "version": "8.x-3.8", + "datestamp": "1536512284", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + }, + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + }, + "installation-source": "dist", + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "dawehner", + "homepage": "https://www.drupal.org/user/99340" + }, + { + "name": "e2thex", + "homepage": "https://www.drupal.org/user/189123" + }, + { + "name": "febbraro", + "homepage": "https://www.drupal.org/user/43670" + }, + { + "name": "jmiccolis", + "homepage": "https://www.drupal.org/user/31731" + }, + { + "name": "mpotter", + "homepage": "https://www.drupal.org/user/616192" + }, + { + "name": "nedjo", + "homepage": "https://www.drupal.org/user/4481" + }, + { + "name": "tim.plunkett", + "homepage": "https://www.drupal.org/user/241634" + } + ], + "description": "Enables administrators to package configuration into modules", + "homepage": "https://www.drupal.org/project/features", + "support": { + "source": "http://cgit.drupalcode.org/features" + } + }, { "name": "drupal/field_collection", "version": "1.0.0-alpha1", diff --git a/web/modules/features/LICENSE.txt~HEAD b/web/modules/features/LICENSE.txt similarity index 100% rename from web/modules/features/LICENSE.txt~HEAD rename to web/modules/features/LICENSE.txt diff --git a/web/modules/features/LICENSE.txt~master b/web/modules/features/LICENSE.txt~master deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/features/LICENSE.txt~master +++ /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/features/composer.json b/web/modules/features/composer.json index 1b7a61d37b..de7ea040a6 100644 --- a/web/modules/features/composer.json +++ b/web/modules/features/composer.json @@ -6,5 +6,12 @@ "require": { "drupal/config_update": "^1.4" }, - "type": "drupal-module" + "type": "drupal-module", + "extra": { + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + } } diff --git a/web/modules/features/drush/features.drush8.inc b/web/modules/features/drush/features.drush8.inc index b4abe91f05..35a76abe83 100644 --- a/web/modules/features/drush/features.drush8.inc +++ b/web/modules/features/drush/features.drush8.inc @@ -6,6 +6,7 @@ */ use Drupal\features\ConfigurationItem; +use Drupal\features\FeaturesBundleInterface; use Drupal\features\FeaturesManagerInterface; use Drupal\features\Plugin\FeaturesGeneration\FeaturesGenerationWrite; use Drupal\Component\Diff\DiffFormatter; @@ -14,118 +15,118 @@ * Implements hook_drush_command(). */ function features_drush_command() { - $items = array(); + $items = []; - $items['features-status'] = array( + $items['features-status'] = [ 'description' => 'Display current Features settings.', - 'aliases' => array('fs'), - ); + 'aliases' => ['fs'], + ]; - $items['features-list-packages'] = array( + $items['features-list-packages'] = [ 'description' => 'Display a list of all existing features and packages available to be generated. If a package name is provided as an argument, then all of the configuration objects assigned to that package will be listed.', - 'examples' => array( + 'examples' => [ "drush features-list-packages" => 'Display a list of all existing featurea and packages available to be generated.', "drush features-list-packages 'example_article'" => "Display a list of all configuration objects assigned to the 'example_article' package.", - ), - 'arguments' => array( + ], + 'arguments' => [ 'package' => 'The package to list. Optional; if specified, lists all configuration objects assigned to that package. If no package is specified, lists all of the features.', - ), - 'outputformat' => array( + ], + 'outputformat' => [ 'default' => 'table', 'pipe-format' => 'list', - 'field-labels' => array( + 'field-labels' => [ 'name' => 'Name', 'machine_name' => 'Machine name', 'status' => 'Status', 'version' => 'Version', 'state' => 'State', 'object' => 'Configuration object', - ), + ], 'output-data-type' => 'format-table', - ), - 'aliases' => array('fl'), - ); + ], + 'aliases' => ['fl'], + ]; - $items['features-import-all'] = array( + $items['features-import-all'] = [ 'description' => 'Import module config from all installed features.', - 'examples' => array( + 'examples' => [ "drush features-import-all" => 'Import module config from all installed features.', - ), - 'aliases' => array('fra', 'fia', 'fim-all'), - ); + ], + 'aliases' => ['fra', 'fia', 'fim-all'], + ]; - $items['features-export'] = array( + $items['features-export'] = [ 'description' => "Export the configuration on your site into a custom module.", - 'arguments' => array( + 'arguments' => [ 'package' => 'A space delimited list of features to export.', - ), - 'options' => array( + ], + 'options' => [ 'add-profile' => 'Package features into an install profile.', - ), - 'examples' => array( + ], + 'examples' => [ "drush features-export" => 'Export all available packages.', "drush features-export example_article example_page" => "Export the example_article and example_page packages.", "drush features-export --add-profile" => "Export all available packages and add them to an install profile.", - ), + ], // Add previous "fu" alias for compatibility. - 'aliases' => array('fex', 'fu', 'fua', 'fu-all'), - ); + 'aliases' => ['fex', 'fu', 'fua', 'fu-all'], + ]; - $items['features-add'] = array( + $items['features-add'] = [ 'description' => "Add a config item to a feature package.", - 'arguments' => array( + 'arguments' => [ 'feature' => 'Feature package to export and add config to.', 'components' => 'Patterns of config to add, see features-components for the format of patterns.', - ), - 'aliases' => array('fa', 'fe'), - ); + ], + 'aliases' => ['fa', 'fe'], + ]; - $items['features-components'] = array( + $items['features-components'] = [ 'description' => 'List features components.', - 'arguments' => array( + 'arguments' => [ 'patterns' => 'The features components type to list. Omit this argument to list all components.', - ), - 'options' => array( - 'exported' => array( + ], + 'options' => [ + 'exported' => [ 'description' => 'Show only components that have been exported.', - ), - 'not-exported' => array( + ], + 'not-exported' => [ 'description' => 'Show only components that have not been exported.', - ), - ), - 'aliases' => array('fc'), - ); + ], + ], + 'aliases' => ['fc'], + ]; - $items['features-diff'] = array( + $items['features-diff'] = [ 'description' => "Show the difference between the active config and the default config stored in a feature package.", - 'arguments' => array( + 'arguments' => [ 'feature' => 'The feature in question.', - ), - 'options' => array( + ], + 'options' => [ 'ctypes' => 'Comma separated list of component types to limit the output to. Defaults to all types.', 'lines' => 'Generate diffs with <n> lines of context instead of the usual two.', - ), - 'aliases' => array('fd'), - ); + ], + 'aliases' => ['fd'], + ]; - $items['features-import'] = array( + $items['features-import'] = [ 'description' => "Import a module config into your site.", - 'arguments' => array( + 'arguments' => [ 'feature' => 'A space delimited list of features or feature:component pairs to import.', - ), - 'options' => array( + ], + 'options' => [ 'force' => "Force import even if config is not overridden.", - ), - 'examples' => array( + ], + 'examples' => [ 'drush features-import foo:node.type.page foo:taxonomy.vocabulary.tags bar' => 'Import node and taxonomy config of feature "foo". Import all config of feature "bar".', - ), - 'aliases' => array('fim', 'fr'), - ); + ], + 'aliases' => ['fim', 'fr'], + ]; foreach ($items as $name => &$item) { - $item['options']['bundle'] = array( + $item['options']['bundle'] = [ 'description' => 'Use a specific bundle namespace.', - ); + ]; } return $items; @@ -145,7 +146,7 @@ function _drush_features_options() { if (!empty($bundle_name)) { $bundle = $assigner->applyBundle($bundle_name); if ($bundle->getMachineName() != $bundle_name) { - drush_log(dt('Bundle @name not found. Using default.', array('@name' => $bundle_name)), 'warning'); + drush_log(dt('Bundle @name not found. Using default.', ['@name' => $bundle_name]), 'warning'); } } else { @@ -172,13 +173,13 @@ function drush_features_status() { } else { drush_print(dt('Current bundle: @name (@machine_name)', - array( + [ '@name' => $current_bundle->getName(), '@machine_name' => $current_bundle->getMachineName(), - ))); + ])); } - drush_print(dt('Export folder: @folder', array('@folder' => $export_settings['folder']))); - $dt_args = array('@methods' => implode(', ', array_keys($methods))); + drush_print(dt('Export folder: @folder', ['@folder' => $export_settings['folder']])); + $dt_args = ['@methods' => implode(', ', array_keys($methods))]; drush_print(dt('The following assignment methods are enabled:')); drush_print(dt(' @methods', $dt_args)); @@ -204,18 +205,18 @@ function drush_features_status() { function drush_features_list_packages($package_name = '') { $assigner = _drush_features_options(); $current_bundle = $assigner->getBundle(); - $namespace = $current_bundle->isDefault() ? '' : $current_bundle->getMachineName(); + $namespace = $current_bundle->isDefault() ? FeaturesBundleInterface::DEFAULT_BUNDLE : $current_bundle->getMachineName(); /** @var \Drupal\features\FeaturesManagerInterface $manager */ $manager = \Drupal::service('features.manager'); $packages = $manager->getPackages(); $packages = $manager->filterPackages($packages, $namespace); - $result = array(); + $result = []; // If no package was specified, list all packages. if (empty($package_name)) { - drush_hide_output_fields(array('object')); + drush_hide_output_fields(['object']); foreach ($packages as $package) { $overrides = $manager->detectOverrides($package); $state = $package->getState(); @@ -223,7 +224,7 @@ function drush_features_list_packages($package_name = '') { $state = FeaturesManagerInterface::STATE_OVERRIDDEN; } - $result[$package->getMachineName()] = array( + $result[$package->getMachineName()] = [ 'name' => $package->getName(), 'machine_name' => $package->getMachineName(), 'status' => $manager->statusLabel($package->getStatus()), @@ -231,7 +232,7 @@ function drush_features_list_packages($package_name = '') { 'state' => ($state != FeaturesManagerInterface::STATE_DEFAULT) ? $manager->stateLabel($state) : '', - ); + ]; } return $result; } @@ -239,17 +240,17 @@ function drush_features_list_packages($package_name = '') { else { foreach ($packages as $package) { if ($package->getMachineName() == $package_name) { - drush_hide_output_fields(array( + drush_hide_output_fields([ 'machine_name', 'name', 'status', 'version', 'state', - )); + ]); foreach ($package->getConfig() as $item_name) { - $result[$item_name] = array( + $result[$item_name] = [ 'object' => $item_name, - ); + ]; } return $result; } @@ -258,7 +259,7 @@ function drush_features_list_packages($package_name = '') { } // If no matching package found, return an error. - drush_log(dt('Package "@package" not found.', array('@package' => $package_name)), 'warning'); + drush_log(dt('Package "@package" not found.', ['@package' => $package_name]), 'warning'); return FALSE; } @@ -269,13 +270,13 @@ function drush_features_list_packages($package_name = '') { function drush_features_import_all() { $assigner = _drush_features_options(); $current_bundle = $assigner->getBundle(); - $namespace = $current_bundle->isDefault() ? '' : $current_bundle->getMachineName(); + $namespace = $current_bundle->isDefault() ? FeaturesBundleInterface::DEFAULT_BUNDLE : $current_bundle->getMachineName(); /** @var \Drupal\features\FeaturesManagerInterface $manager */ $manager = \Drupal::service('features.manager'); $packages = $manager->getPackages(); $packages = $manager->filterPackages($packages, $namespace); - $overridden = array(); + $overridden = []; foreach ($packages as $package) { $overrides = $manager->detectOverrides($package); @@ -317,13 +318,13 @@ function drush_features_export($packages = NULL) { $all_packages = $manager->getPackages(); foreach ($packages as $name) { if (!isset($all_packages[$name])) { - return drush_set_error('', dt("The package @name does not exist.", array('@name' => $name))); + return drush_set_error('', dt("The package @name does not exist.", ['@name' => $name])); } } if (empty($packages)) { $packages = $all_packages; - $dt_args = array('@modules' => implode(', ', array_keys($packages))); + $dt_args = ['@modules' => implode(', ', array_keys($packages))]; drush_print(dt('The following extensions will be exported: @modules', $dt_args)); if (!drush_confirm(dt('Do you really want to continue?'))) { return drush_user_abort('Aborting.'); @@ -333,7 +334,7 @@ function drush_features_export($packages = NULL) { // If any packages exist, confirm before overwriting. if ($existing_packages = $manager->listPackageDirectories($packages, $current_bundle)) { foreach ($existing_packages as $name => $directory) { - drush_print(dt("The extension @name already exists at @directory.", array('@name' => $name, '@directory' => $directory))); + drush_print(dt("The extension @name already exists at @directory.", ['@name' => $name, '@directory' => $directory])); } // Apparently, format_plural is not always available. if (count($existing_packages) == 1) { @@ -379,9 +380,9 @@ function drush_features_add() { return drush_set_error('', 'No components supplied.'); } $components = _drush_features_component_list(); - $options = array( + $options = [ 'exported' => FALSE, - ); + ]; $filtered_components = _drush_features_component_filter($components, $args, $options); $items = $filtered_components['components']; @@ -390,11 +391,11 @@ function drush_features_add() { return drush_set_error('', 'No components to add.'); } - $packages = array($module); + $packages = [$module]; // If any packages exist, confirm before overwriting. if ($existing_packages = $manager->listPackageDirectories($packages)) { foreach ($existing_packages as $name => $directory) { - drush_print(dt("The extension @name already exists at @directory.", array('@name' => $name, '@directory' => $directory))); + drush_print(dt("The extension @name already exists at @directory.", ['@name' => $name, '@directory' => $directory])); } // Apparently, format_plural is not always available. if (count($existing_packages) == 1) { @@ -410,7 +411,7 @@ function drush_features_add() { else { $package = $manager->initPackage($module, NULL, '', 'module', $current_bundle); list($full_name, $path) = $manager->getExportInfo($package, $current_bundle); - drush_print(dt('Will create a new extension @name in @directory', array('@name' => $full_name, '@directory' => $path))); + drush_print(dt('Will create a new extension @name in @directory', ['@name' => $full_name, '@directory' => $path])); if (!drush_confirm(dt('Do you really want to continue?'))) { drush_die('Aborting.'); } @@ -452,15 +453,15 @@ function drush_features_components() { return; } - $args = ($choice == 0) ? array('*') : array($types[$choice]); + $args = ($choice == 0) ? ['*'] : [$types[$choice]]; } - $options = array( + $options = [ 'provided by' => TRUE, - ); - if (drush_get_option(array('exported', 'e'), NULL)) { + ]; + if (drush_get_option(['exported', 'e'], NULL)) { $options['not exported'] = FALSE; } - elseif (drush_get_option(array('not-exported', 'o'), NULL)) { + elseif (drush_get_option(['not-exported', 'o'], NULL)) { $options['exported'] = FALSE; } @@ -496,7 +497,7 @@ function drush_features_diff() { $feature = $manager->loadPackage($module, TRUE); if (empty($feature)) { - drush_log(dt('No such feature is available: @module', array('@module' => $module)), 'error'); + drush_log(dt('No such feature is available: @module', ['@module' => $module]), 'error'); return; } @@ -521,7 +522,7 @@ function drush_features_diff() { $overrides = array_merge($overrides, $missing); if (empty($overrides)) { - drush_print(dt('Active config matches stored config for @module.', array('@module' => $module))); + drush_print(dt('Active config matches stored config for @module.', ['@module' => $module])); } else { /** @var \Drupal\config_update\ConfigDiffInterface $config_diff */ @@ -538,20 +539,20 @@ function drush_features_diff() { $message = ''; if (in_array($name, $missing)) { $message = sprintf($red, t('(missing from active)')); - $extension = array(); + $extension = []; } else { $active = $manager->getActiveStorage()->read($name); $extension = $manager->getExtensionStorages()->read($name); if (empty($extension)) { - $extension = array(); + $extension = []; $message = sprintf($green, t('(not exported)')); } $diff = $config_diff->diff($extension, $active); $rows = explode("\n", $formatter->format($diff)); } drush_print(); - drush_print(dt("Config @name @message", array('@name' => $name, '@message' => $message))); + drush_print(dt("Config @name @message", ['@name' => $name, '@message' => $message])); if (!empty($extension)) { foreach ($rows as $row) { if (strpos($row, '>') === 0) { @@ -588,7 +589,7 @@ function drush_features_import() { $manager = \Drupal::service('features.manager'); // Parse list of arguments. - $modules = array(); + $modules = []; foreach ($args as $arg) { $arg = explode(':', $arg); $module = array_shift($arg); @@ -602,7 +603,7 @@ function drush_features_import() { } elseif ($modules[$module] !== TRUE) { if (!isset($modules[$module])) { - $modules[$module] = array(); + $modules[$module] = []; } $modules[$module][] = $component; } @@ -692,7 +693,7 @@ function drush_features_import() { function _drush_features_build_config(array $items) { /** @var \Drupal\features\FeaturesManagerInterface $manager */ $manager = \Drupal::service('features.manager'); - $result = array(); + $result = []; foreach ($items as $config_type => $item) { foreach ($item as $item_name => $title) { $result[] = $manager->getFullName($config_type, $item_name); @@ -705,7 +706,7 @@ function _drush_features_build_config(array $items) { * Returns a listing of all known components, indexed by source. */ function _drush_features_component_list() { - $result = array(); + $result = []; /** @var \Drupal\features\FeaturesManagerInterface $manager */ $manager = \Drupal::service('features.manager'); $config = $manager->getConfigCollection(); @@ -718,13 +719,13 @@ function _drush_features_component_list() { /** * Filters components by patterns. */ -function _drush_features_component_filter($all_components, $patterns = array(), $options = array()) { - $options += array( +function _drush_features_component_filter($all_components, $patterns = [], $options = []) { + $options += [ 'exported' => TRUE, 'not exported' => TRUE, 'provided by' => FALSE, - ); - $pool = array(); + ]; + $pool = []; // Maps exported components to feature modules. $components_map = _drush_features_get_component_map(); // First filter on exported state. @@ -753,11 +754,11 @@ function _drush_features_component_filter($all_components, $patterns = array(), $state_string = 'exported'; } - $selected = array(); + $selected = []; foreach ($patterns as $pattern) { // Rewrite * to %. Let users use both as wildcard. - $pattern = strtr($pattern, array('*' => '%')); - $sources = array(); + $pattern = strtr($pattern, ['*' => '%']); + $sources = []; list($source_pattern, $component_pattern) = explode(':', $pattern, 2); // If source is empty, use a pattern. if ($source_pattern == '') { @@ -767,8 +768,8 @@ function _drush_features_component_filter($all_components, $patterns = array(), $component_pattern = '%'; } - $preg_source_pattern = strtr(preg_quote($source_pattern, '/'), array('%' => '.*')); - $preg_component_pattern = strtr(preg_quote($component_pattern, '/'), array('%' => '.*')); + $preg_source_pattern = strtr(preg_quote($source_pattern, '/'), ['%' => '.*']); + $preg_component_pattern = strtr(preg_quote($component_pattern, '/'), ['%' => '.*']); // If it isn't a pattern, but a simple string, we don't anchor the // pattern. This allows for abbreviating. Otherwise, we do, as this seems // more natural for patterns. @@ -778,7 +779,7 @@ function _drush_features_component_filter($all_components, $patterns = array(), if (strpos($component_pattern, '%') !== FALSE) { $preg_component_pattern = '^' . $preg_component_pattern . '$'; } - $matches = array(); + $matches = []; // Find the sources. $all_sources = array_keys($pool); @@ -789,20 +790,20 @@ function _drush_features_component_filter($all_components, $patterns = array(), // use that, or error out. if (count($matches) > 1 and $preg_source_pattern[0] != '^') { if (in_array($source_pattern, $matches)) { - $matches = array($source_pattern); + $matches = [$source_pattern]; } else { - return drush_set_error('', dt('Ambiguous source "@source", matches @matches', array( + return drush_set_error('', dt('Ambiguous source "@source", matches @matches', [ '@source' => $source_pattern, '@matches' => implode(', ', $matches), - ))); + ])); } } // Loose the indexes preg_grep preserved. $sources = array_values($matches); } else { - return drush_set_error('', dt('No @state sources match "@source"', array('@state' => $state_string, '@source' => $source_pattern))); + return drush_set_error('', dt('No @state sources match "@source"', ['@state' => $state_string, '@source' => $source_pattern])); } // Now find the components. @@ -817,17 +818,17 @@ function _drush_features_component_filter($all_components, $patterns = array(), // use that, or error out. if (count($matches) > 1 and $preg_component_pattern[0] != '^') { if (in_array($component_pattern, $matches)) { - $matches = array($component_pattern); + $matches = [$component_pattern]; } else { - return drush_set_error('', dt('Ambiguous component "@component", matches @matches', array( + return drush_set_error('', dt('Ambiguous component "@component", matches @matches', [ '@component' => $component_pattern, '@matches' => implode(', ', $matches), - ))); + ])); } } if (!is_array($selected[$source])) { - $selected[$source] = array(); + $selected[$source] = []; } $selected[$source] += array_intersect_key($pool[$source], array_flip($matches)); } @@ -835,11 +836,11 @@ function _drush_features_component_filter($all_components, $patterns = array(), // No matches. If the source was a pattern, just carry on, else // error out. Allows for patterns like :*field* if ($preg_source_pattern[0] != '^') { - return drush_set_error('', dt('No @state @source components match "@component"', array( + return drush_set_error('', dt('No @state @source components match "@component"', [ '@state' => $state_string, '@component' => $component_pattern, '@source' => $source, - ))); + ])); } } } @@ -847,7 +848,7 @@ function _drush_features_component_filter($all_components, $patterns = array(), // Lastly, provide feature module information on the selected components, if // requested. - $provided_by = array(); + $provided_by = []; if ($options['provided by'] && $options['exported']) { foreach ($selected as $source => $components) { foreach ($components as $name => $title) { @@ -859,17 +860,17 @@ function _drush_features_component_filter($all_components, $patterns = array(), } } - return array( + return [ 'components' => $selected, 'sources' => $provided_by, - ); + ]; } /** * Provides a component to feature map (port of features_get_component_map). */ function _drush_features_get_component_map() { - $result = array(); + $result = []; /** @var \Drupal\features\FeaturesManagerInterface $manager */ $manager = \Drupal::service('features.manager'); // Recalc full config list without running assignments. @@ -881,7 +882,7 @@ function _drush_features_get_component_map() { $short_name = $item->getShortName(); $name = $item->getName(); if (!isset($result[$type][$short_name])) { - $result[$type][$short_name] = array(); + $result[$type][$short_name] = []; } if (!empty($item->getPackage())) { $package = $packages[$item->getPackage()]; @@ -896,10 +897,10 @@ function _drush_features_get_component_map() { * Prints a list of filtered components. */ function _drush_features_component_print($filtered_components) { - $rows = array(array(dt('Available sources'))); + $rows = [[dt('Available sources')]]; foreach ($filtered_components['components'] as $source => $components) { foreach ($components as $name => $value) { - $row = array($source . ':' . $name); + $row = [$source . ':' . $name]; if (isset($filtered_components['sources'][$source . ':' . $name])) { $row[] = dt('Provided by') . ': ' . $filtered_components['sources'][$source . ':' . $name]; } diff --git a/web/modules/features/features.info.yml b/web/modules/features/features.info.yml index 197574cbd5..65cef8a96c 100644 --- a/web/modules/features/features.info.yml +++ b/web/modules/features/features.info.yml @@ -4,11 +4,11 @@ description: 'Enables administrators to package configuration into modules.' package: Development # core: 8.x dependencies: - - config - - config_update + - drupal:config + - config_update:config_update -# Information added by Drupal.org packaging script on 2018-02-27 -version: '8.x-3.7' +# Information added by Drupal.org packaging script on 2018-09-09 +version: '8.x-3.8' core: '8.x' project: 'features' -datestamp: 1519763291 +datestamp: 1536512288 diff --git a/web/modules/features/features.module b/web/modules/features/features.module index 3fccc79c4d..3bf4bf7348 100644 --- a/web/modules/features/features.module +++ b/web/modules/features/features.module @@ -15,9 +15,9 @@ function features_help($route_name, RouteMatchInterface $route_match) { case 'help.page.features': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Features module provides a user interface for exporting bundles of configuration into modules. For more information, see the online documentation for <a href=":url">Features module</a>', array( + $output .= '<p>' . t('The Features module provides a user interface for exporting bundles of configuration into modules. For more information, see the online documentation for <a href=":url">Features module</a>', [ ':url' => 'http://drupal.org/node/2404427', - )) . '</p>'; + ]) . '</p>'; return $output; } } @@ -37,9 +37,9 @@ function features_file_download($uri) { // "export configuration" permission, token is validated by the controller. // @see \Drupal\features\Controller\FeaturesController::downloadExport() if ($route == 'features.export_download') { - return array( + return [ 'Content-disposition' => 'attachment; filename="' . $target . '"', - ); + ]; } } } diff --git a/web/modules/features/modules/features_ui/css/features_ui.admin.css b/web/modules/features/modules/features_ui/css/features_ui.admin.css index 529a7aa851..1f8a781789 100644 --- a/web/modules/features/modules/features_ui/css/features_ui.admin.css +++ b/web/modules/features/modules/features_ui/css/features_ui.admin.css @@ -143,8 +143,7 @@ span.features-component-list span { margin-right:5px; padding:2px 5px; background:#eee; - -moz-border-radius:5px; - -webkit-border-radius:5px; + border-radius:5px; } div.features-export-empty { @@ -172,8 +171,7 @@ span.features-component-list .features-dependency { display: inline-block; background: transparent; border: 1px solid #DDD; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; + border-radius: 5px; white-space: nowrap; padding: 0 8px; margin: 0 10px 0 0; @@ -238,8 +236,7 @@ span.features-component-list .features-dependency { padding: 0 5px; background: transparent; background: #EEE; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; + border-radius: 5px; cursor: pointer; } #features-filter span:hover { diff --git a/web/modules/features/modules/features_ui/features_ui.admin.inc b/web/modules/features/modules/features_ui/features_ui.admin.inc index 408410ac9b..0b7186252e 100644 --- a/web/modules/features/modules/features_ui/features_ui.admin.inc +++ b/web/modules/features/modules/features_ui/features_ui.admin.inc @@ -23,60 +23,60 @@ function theme_features_listing(array $variables) { $renderer = \Drupal::service('renderer'); // Individual table headers. - $rows = array(); + $rows = []; // Iterate through all the features, which are children of this element. foreach (Element::children($form) as $key) { // Stick the key into $module for easier access. $element = $form[$key]; // Create the row for the table. - $row = array(); + $row = []; // Add the checkbox into the first cell. unset($element['enable']['#title']); - $row[] = array('class' => array('checkbox'), 'data' => $renderer->render($element['enable'])); + $row[] = ['class' => ['checkbox'], 'data' => $renderer->render($element['enable'])]; // Add the module label and expand/collapse functionalty. $id = Html::getUniqueId('feature-' . $key); $col2 = new FormattableMarkup('<label id="@id" for="@for" class="module-name table-filter-text-source">@name</label>', - array( + [ '@id' => $id, '@for' => $element['enable']['#id'], '@name' => $renderer->render($element['name']), - ) + ] ); - $row[] = array('class' => array('module'), 'data' => $col2); + $row[] = ['class' => ['module'], 'data' => $col2]; - $row[] = array('class' => array('machine_name'), 'data' => $renderer->render($element['machine_name'])); + $row[] = ['class' => ['machine_name'], 'data' => $renderer->render($element['machine_name'])]; - $description = t('@details', array('@details' => $renderer->render($element['details']))); - $details = array( + $description = t('@details', ['@details' => $renderer->render($element['details'])]); + $details = [ '#type' => 'details', - '#title' => new FormattableMarkup('<span class="text">@desc</span>', array( '@desc' => $renderer->render($element['description']))), - '#attributes' => array('id' => $element['enable']['#id'] . '-description'), + '#title' => new FormattableMarkup('<span class="text">@desc</span>', [ '@desc' => $renderer->render($element['description'])]), + '#attributes' => ['id' => $element['enable']['#id'] . '-description'], '#description' => $description, - ); - $row[] = array( - 'class' => array('description', 'expand'), + ]; + $row[] = [ + 'class' => ['description', 'expand'], 'data' => $renderer->render($details), - ); - $row[] = array( - 'class' => array('feature-version'), + ]; + $row[] = [ + 'class' => ['feature-version'], 'data' => $renderer->render($element['version']), - ); - $row[] = array( - 'class' => array('feature-state'), + ]; + $row[] = [ + 'class' => ['feature-state'], 'data' => $renderer->render($element['state']), - ); + ]; - $rows[] = array('data' => $row); + $rows[] = ['data' => $row]; } - $table = array( + $table = [ '#type' => 'tableselect', '#header' => $form['#header'], '#options' => $rows, '#empty' => t('No Features packages available.'), - ); + ]; return $renderer->render($table); } @@ -90,31 +90,31 @@ function theme_features_listing(array $variables) { function template_preprocess_features_assignment_configure_form(&$variables) { $form =& $variables['form']; - $header = array( + $header = [ t('Assignment method'), t('Description'), t('Enabled'), t('Weight'), - ); + ]; // If there is at least one operation enabled, show the operation column. if ($form['#show_operations']) { $header[] = t('Operations'); } - $table = array( + $table = [ '#type' => 'table', '#weight' => 5, '#header' => $header, - '#attributes' => array('id' => 'features-assignment-methods'), - '#tabledrag' => array( - array( + '#attributes' => ['id' => 'features-assignment-methods'], + '#tabledrag' => [ + [ 'action' => 'order', 'relationship' => 'sibling', 'group' => 'assignment-method-weight', - ), - ), - ); + ], + ], + ]; foreach ($form['title'] as $id => $element) { // Do not take form control structures. @@ -122,11 +122,11 @@ function template_preprocess_features_assignment_configure_form(&$variables) { $table[$id]['#attributes']['class'][] = 'draggable'; $table[$id]['#weight'] = $element['#weight']; - $table[$id]['title'] = array( + $table[$id]['title'] = [ '#prefix' => '<strong>', $form['title'][$id], '#suffix' => '</strong>', - ); + ]; $table[$id]['description'] = $form['description'][$id]; $table[$id]['enabled'] = $form['enabled'][$id]; $table[$id]['weight'] = $form['weight'][$id]; @@ -157,7 +157,7 @@ function template_preprocess_features_assignment_configure_form(&$variables) { function theme_features_items(array $variables) { $items = $variables['items']; - $list = array(); + $list = []; foreach ($items as $item) { $class = !empty($item['class']) ? $item['class'] : ''; $list[] = '<span class="features-item ' . $class . '" title="' . $item['name'] . '">' . $item['label'] . '</span>'; diff --git a/web/modules/features/modules/features_ui/features_ui.info.yml b/web/modules/features/modules/features_ui/features_ui.info.yml index a5d3cbd89c..d78b3f7722 100644 --- a/web/modules/features/modules/features_ui/features_ui.info.yml +++ b/web/modules/features/modules/features_ui/features_ui.info.yml @@ -5,10 +5,10 @@ package: Development # core: 8.x configure: features.assignment dependencies: - - features + - features:features -# Information added by Drupal.org packaging script on 2018-02-27 -version: '8.x-3.7' +# Information added by Drupal.org packaging script on 2018-09-09 +version: '8.x-3.8' core: '8.x' project: 'features' -datestamp: 1519763291 +datestamp: 1536512288 diff --git a/web/modules/features/modules/features_ui/features_ui.module b/web/modules/features/modules/features_ui/features_ui.module index 0eae3ee0ae..1860427bd4 100644 --- a/web/modules/features/modules/features_ui/features_ui.module +++ b/web/modules/features/modules/features_ui/features_ui.module @@ -14,10 +14,10 @@ function features_ui_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'features.assignment': $output = ''; - $output .= '<p>' . t('Bundles are used to collect together groups of features. A bundle provides a shared <a href=":namespace">namespace</a> for all features included in it, which prevents conflicts and helps distinguish your features from those produced for other purposes. Common uses of bundles include:', array(':namespace' => 'http://en.wikipedia.org/wiki/Namespace')); + $output .= '<p>' . t('Bundles are used to collect together groups of features. A bundle provides a shared <a href=":namespace">namespace</a> for all features included in it, which prevents conflicts and helps distinguish your features from those produced for other purposes. Common uses of bundles include:', [':namespace' => 'http://en.wikipedia.org/wiki/Namespace']); $output .= '<ul>'; $output .= '<li>' . t('Custom features for use on a particular site.') . '</li>'; - $output .= '<li>' . t('The features of a given <a href=":distributions">distribution</a>.', array(':distributions' => 'https://www.drupal.org/documentation/build/distributions')) . '</li>'; + $output .= '<li>' . t('The features of a given <a href=":distributions">distribution</a>.', [':distributions' => 'https://www.drupal.org/documentation/build/distributions']) . '</li>'; $output .= '</ul></p>'; $output .= '<p>' . t('Use the form below to manage bundles. Each bundle comes with a set of assignment methods. By configuring and ordering the assignment methods, you can set the defaults for what does and doesn\'t get packaged into features for your bundle. Use the <em>Bundle</em> select to choose which bundle to edit, or chose <em>--New--</em> to create a new bundle. The <em>Default</em> bundle does not include a namespace and cannot be deleted.') . '</p>'; return $output; @@ -33,23 +33,23 @@ function features_ui_help($route_name, RouteMatchInterface $route_match) { * Implements hook_theme(). */ function features_ui_theme() { - return array( - 'features_listing' => array( + return [ + 'features_listing' => [ 'render element' => 'form', 'file' => 'features_ui.admin.inc', 'function' => 'theme_features_listing', - ), - 'features_assignment_configure_form' => array( + ], + 'features_assignment_configure_form' => [ 'render element' => 'form', 'file' => 'features_ui.admin.inc', 'function' => 'theme_assignment_form', - ), - 'features_items' => array( - 'variables' => array( - 'items' => array(), - ), + ], + 'features_items' => [ + 'variables' => [ + 'items' => [], + ], 'file' => 'features_ui.admin.inc', 'function' => 'theme_features_items', - ), - ); + ], + ]; } diff --git a/web/modules/features/modules/features_ui/src/Controller/FeaturesUIController.php b/web/modules/features/modules/features_ui/src/Controller/FeaturesUIController.php index 1462b499a6..786a51cd05 100644 --- a/web/modules/features/modules/features_ui/src/Controller/FeaturesUIController.php +++ b/web/modules/features/modules/features_ui/src/Controller/FeaturesUIController.php @@ -58,14 +58,14 @@ public static function create(ContainerInterface $container) { * List of auto-detected config items, keyed by type and short name. */ public function detect($name) { - $detected = array(); + $detected = []; $this->assigner->assignConfigPackages(); $config_collection = $this->featuresManager->getConfigCollection(); $items = $_POST['items']; if (!empty($items)) { - $excluded = (!empty($_POST['excluded'])) ? $_POST['excluded'] : array(); - $selected = array(); + $excluded = (!empty($_POST['excluded'])) ? $_POST['excluded'] : []; + $selected = []; foreach ($items as $key) { preg_match('/^([^\[]+)(\[.+\])?\[(.+)\]\[(.+)\]$/', $key, $matches); if (!empty($matches[1]) && !empty($matches[4])) { @@ -76,7 +76,7 @@ public function detect($name) { } } } - $detected = !empty($selected) ? $this->getConfigDependents($selected, $name) : array(); + $detected = !empty($selected) ? $this->getConfigDependents($selected, $name) : []; $detected = array_merge($detected, $selected); } @@ -112,7 +112,7 @@ protected function getConfigDependents(array $item_names, $package_name) { // Add any existing auto-detected items already in the package config $this->package = $packages[$package_name]; - $package_config = isset($this->package) ? $this->package->getConfig() : array(); + $package_config = isset($this->package) ? $this->package->getConfig() : []; $package_config = !empty($package_config) ? array_unique(array_merge($package_config, $item_names)) : $item_names; foreach ($package_config as $config_name) { if (!$config_collection[$config_name]->getPackageExcluded()) { @@ -177,7 +177,7 @@ protected function domDecode($key) { * An encoding map. */ protected function domEncodeMap() { - return array( + return [ ':' => '__' . ord(':') . '__', '/' => '__' . ord('/') . '__', ',' => '__' . ord(',') . '__', @@ -187,7 +187,7 @@ protected function domEncodeMap() { '%' => '__' . ord('%') . '__', ')' => '__' . ord(')') . '__', '(' => '__' . ord('(') . '__', - ); + ]; } } diff --git a/web/modules/features/modules/features_ui/src/Form/AssignmentAlterForm.php b/web/modules/features/modules/features_ui/src/Form/AssignmentAlterForm.php index a29963358e..462ee0ba5f 100644 --- a/web/modules/features/modules/features_ui/src/Form/AssignmentAlterForm.php +++ b/web/modules/features/modules/features_ui/src/Form/AssignmentAlterForm.php @@ -29,26 +29,26 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $uuid_setting = $settings['uuid']; $user_permissions_setting = $settings['user_permissions']; - $form['core'] = array( + $form['core'] = [ '#type' => 'checkbox', '#title' => $this->t('Strip out <em>_core</em> property.'), '#default_value' => $core_setting, '#description' => $this->t('Select this option to remove the <em>_core</em> configuration property on export. This property is added by Drupal core when configuration is installed.'), - ); + ]; - $form['uuid'] = array( + $form['uuid'] = [ '#type' => 'checkbox', '#title' => $this->t('Strip out <em>uuid</em> property.'), '#default_value' => $uuid_setting, '#description' => $this->t('Select this option to remove the <em>uuid</em> configuration property on export. This property is added by Drupal core when configuration is installed.'), - ); + ]; - $form['user_permissions'] = array( + $form['user_permissions'] = [ '#type' => 'checkbox', '#title' => $this->t('Strip out user permissions.'), '#default_value' => $user_permissions_setting, '#description' => $this->t('Select this option to remove permissions from user roles on export.'), - ); + ]; $this->setActions($form, self::METHOD_ID); diff --git a/web/modules/features/modules/features_ui/src/Form/AssignmentConfigureForm.php b/web/modules/features/modules/features_ui/src/Form/AssignmentConfigureForm.php index e46862d445..4463082752 100644 --- a/web/modules/features/modules/features_ui/src/Form/AssignmentConfigureForm.php +++ b/web/modules/features/modules/features_ui/src/Form/AssignmentConfigureForm.php @@ -132,7 +132,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $load_values = TRUE; } elseif ($trigger['#name'] == 'bundle[bundle_select]') { - $bundle_name = $form_state->getValue(array('bundle', 'bundle_select')); + $bundle_name = $form_state->getValue(['bundle', 'bundle_select']); if ($bundle_name != self::NEW_BUNDLE_SELECT_VALUE) { $this->assigner->setCurrent($this->assigner->getBundle($bundle_name)); } @@ -142,7 +142,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $current_bundle = $this->assigner->loadBundle($bundle_name); $bundle_name = $current_bundle->getMachineName(); $this->assigner->removeBundle($bundle_name); - return $this->redirect('features.assignment', array('')); + return $this->redirect('features.assignment', ['']); } if (!isset($current_bundle)) { switch ($bundle_name) { @@ -177,28 +177,28 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $this->loadBundleValues($bundle_name, $form_state, $current_bundle, $enabled_methods, $methods_weight); } - $form = array( - '#attached' => array( - 'library' => array( + $form = [ + '#attached' => [ + 'library' => [ // Provides the copyFieldValue behavior invoked below. 'system/drupal.system', 'features_ui/drupal.features_ui.admin', - ), - ), + ], + ], // '#attributes' => array('class' => 'edit-bundles-wrapper'), '#tree' => TRUE, '#show_operations' => FALSE, - 'weight' => array('#tree' => TRUE), + 'weight' => ['#tree' => TRUE], '#prefix' => '<div id="edit-bundles-wrapper">', '#suffix' => '</div>', - ); + ]; - $form['bundle'] = array( + $form['bundle'] = [ '#type' => 'fieldset', '#title' => $this->t('Bundle'), '#tree' => TRUE, '#weight' => -9, - ); + ]; if ($bundle_name == self::NEW_BUNDLE_SELECT_VALUE) { $default_values = [ @@ -220,86 +220,86 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n 'profile_name' => $current_bundle->getProfileName(), ]; } - $form['bundle']['bundle_select'] = array( + $form['bundle']['bundle_select'] = [ '#title' => $this->t('Bundle'), '#title_display' => 'invisible', '#type' => 'select', '#options' => [self::NEW_BUNDLE_SELECT_VALUE => $this->t('--New--')] + $this->assigner->getBundleOptions(), '#default_value' => $default_values['bundle_select'], - '#ajax' => array( + '#ajax' => [ 'callback' => '::updateForm', 'wrapper' => 'edit-bundles-wrapper', - ), - ); + ], + ]; // Don't show the remove button for the default bundle or when adding a new // bundle. if ($bundle_name != self::NEW_BUNDLE_SELECT_VALUE && !$current_bundle->isDefault()) { - $form['bundle']['remove'] = array( + $form['bundle']['remove'] = [ '#type' => 'button', '#name' => 'removebundle', '#value' => $this->t('Remove bundle'), - ); + ]; } - $form['bundle']['name'] = array( + $form['bundle']['name'] = [ '#title' => $this->t('Bundle name'), '#type' => 'textfield', '#description' => $this->t('A unique human-readable name of this bundle.'), '#default_value' => $default_values['name'], '#required' => TRUE, '#disabled' => $bundle_name == FeaturesBundleInterface::DEFAULT_BUNDLE, - ); + ]; // Don't allow changing the default bundle machine name. if ($bundle_name == FeaturesBundleInterface::DEFAULT_BUNDLE) { - $form['bundle']['machine_name'] = array( + $form['bundle']['machine_name'] = [ '#type' => 'value', '#value' => $default_values['machine_name'], - ); + ]; } else { - $form['bundle']['machine_name'] = array( + $form['bundle']['machine_name'] = [ '#title' => $this->t('Machine name'), '#type' => 'machine_name', '#required' => TRUE, '#default_value' => $default_values['machine_name'], '#description' => $this->t('A unique machine-readable name of this bundle. Used to prefix exported packages. It must only contain lowercase letters, numbers, and underscores.'), - '#machine_name' => array( - 'source' => array('bundle', 'name'), - 'exists' => array($this, 'bundleExists'), - ), - ); + '#machine_name' => [ + 'source' => ['bundle', 'name'], + 'exists' => [$this, 'bundleExists'], + ], + ]; } - $form['bundle']['description'] = array( + $form['bundle']['description'] = [ '#title' => $this->t('Distribution description'), '#type' => 'textfield', '#default_value' => $default_values['description'], '#description' => $this->t('A description of the bundle.'), '#size' => 80, - ); + ]; - $form['bundle']['is_profile'] = array( + $form['bundle']['is_profile'] = [ '#type' => 'checkbox', '#title' => $this->t('Include install profile'), '#default_value' => $default_values['is_profile'], '#description' => $this->t('Select this option to have your features packaged into an install profile.'), - '#attributes' => array( + '#attributes' => [ 'data-add-profile' => 'status', - ), - ); - - $show_and_require_if_profile_checked = array( - 'visible' => array( - ':input[data-add-profile="status"]' => array('checked' => TRUE), - ), - 'required' => array( - ':input[data-add-profile="status"]' => array('checked' => TRUE), - ), - ); - - $form['bundle']['profile_name'] = array( + ], + ]; + + $show_and_require_if_profile_checked = [ + 'visible' => [ + ':input[data-add-profile="status"]' => ['checked' => TRUE], + ], + 'required' => [ + ':input[data-add-profile="status"]' => ['checked' => TRUE], + ], + ]; + + $form['bundle']['profile_name'] = [ '#title' => $this->t('Profile name'), '#type' => 'textfield', '#default_value' => $default_values['profile_name'], @@ -307,7 +307,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n '#size' => 30, // Show and require only if the profile.add option is selected. '#states' => $show_and_require_if_profile_checked, - ); + ]; // Attach the copyFieldValue behavior to the profile_name field. In // practice this only works if a user tabs through the bundle machine name @@ -327,48 +327,48 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $method_name = Html::escape($method['name']); - $form['weight'][$method_id] = array( + $form['weight'][$method_id] = [ '#type' => 'weight', - '#title' => $this->t('Weight for @title package assignment method', array('@title' => Unicode::strtolower($method_name))), + '#title' => $this->t('Weight for @title package assignment method', ['@title' => Unicode::strtolower($method_name)]), '#title_display' => 'invisible', '#default_value' => $weight, - '#attributes' => array('class' => array('assignment-method-weight')), + '#attributes' => ['class' => ['assignment-method-weight']], '#delta' => 20, - ); + ]; - $form['title'][$method_id] = array('#markup' => $method_name); + $form['title'][$method_id] = ['#markup' => $method_name]; - $form['enabled'][$method_id] = array( + $form['enabled'][$method_id] = [ '#type' => 'checkbox', - '#title' => $this->t('Enable @title package assignment method', array('@title' => Unicode::strtolower($method_name))), + '#title' => $this->t('Enable @title package assignment method', ['@title' => Unicode::strtolower($method_name)]), '#title_display' => 'invisible', '#default_value' => $enabled, - ); + ]; - $form['description'][$method_id] = array('#markup' => $method['description']); + $form['description'][$method_id] = ['#markup' => $method['description']]; - $config_op = array(); + $config_op = []; if (isset($method['config_route_name'])) { - $config_op['configure'] = array( + $config_op['configure'] = [ 'title' => $this->t('Configure'), - 'url' => Url::fromRoute($method['config_route_name'], array('bundle_name' => $current_bundle->getMachineName())), - ); + 'url' => Url::fromRoute($method['config_route_name'], ['bundle_name' => $current_bundle->getMachineName()]), + ]; // If there is at least one operation enabled, show the operation // column. $form['#show_operations'] = TRUE; } - $form['operation'][$method_id] = array( + $form['operation'][$method_id] = [ '#type' => 'operations', '#links' => $config_op, - ); + ]; } - $form['actions'] = array('#type' => 'actions', '#weight' => 9); - $form['actions']['submit'] = array( + $form['actions'] = ['#type' => 'actions', '#weight' => 9]; + $form['actions']['submit'] = [ '#type' => 'submit', '#button_type' => 'primary', '#value' => $this->t('Save settings'), - ); + ]; return $form; } @@ -384,7 +384,7 @@ public function updateForm($form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { - if ($form_state->getValue(array('bundle', 'is_profile')) && empty($form_state->getValue(array('bundle', 'profile_name')))) { + if ($form_state->getValue(['bundle', 'is_profile']) && empty($form_state->getValue(['bundle', 'profile_name']))) { $form_state->setErrorByName('bundle][profile_name', $this->t('To create a profile, please enter a profile name.')); } @@ -400,28 +400,28 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $method_weights = $form_state->getValue('weight'); ksort($method_weights); - $machine_name = $form_state->getValue(array('bundle', 'machine_name')); + $machine_name = $form_state->getValue(['bundle', 'machine_name']); // If this is a new bundle, create it. - if ($form_state->getValue(array('bundle', 'bundle_select')) == self::NEW_BUNDLE_SELECT_VALUE) { + if ($form_state->getValue(['bundle', 'bundle_select']) == self::NEW_BUNDLE_SELECT_VALUE) { $bundle = $this->assigner->createBundleFromDefault($machine_name); } // Otherwise, load the current bundle and rename if needed. else { $bundle = $this->assigner->loadBundle(); $old_name = $bundle->getMachineName(); - $new_name = $form_state->getValue(array('bundle', 'machine_name')); + $new_name = $form_state->getValue(['bundle', 'machine_name']); if ($old_name != $new_name) { $bundle = $this->assigner->renameBundle($old_name, $new_name); } } - $bundle->setName($form_state->getValue(array('bundle', 'name'))); - $bundle->setDescription($form_state->getValue(array('bundle', 'description'))); + $bundle->setName($form_state->getValue(['bundle', 'name'])); + $bundle->setDescription($form_state->getValue(['bundle', 'description'])); $bundle->setEnabledAssignments(array_keys($enabled_methods)); $bundle->setAssignmentWeights($method_weights); - $bundle->setIsProfile($form_state->getValue(array('bundle', 'is_profile'))); - $bundle->setProfileName($form_state->getValue(array('bundle', 'profile_name'))); + $bundle->setIsProfile($form_state->getValue(['bundle', 'is_profile'])); + $bundle->setProfileName($form_state->getValue(['bundle', 'profile_name'])); $bundle->save(); $this->assigner->setBundle($bundle); $this->assigner->setCurrent($bundle); diff --git a/web/modules/features/modules/features_ui/src/Form/AssignmentExcludeForm.php b/web/modules/features/modules/features_ui/src/Form/AssignmentExcludeForm.php index 741be59fcd..459bf7ce83 100644 --- a/web/modules/features/modules/features_ui/src/Form/AssignmentExcludeForm.php +++ b/web/modules/features/modules/features_ui/src/Form/AssignmentExcludeForm.php @@ -31,72 +31,72 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $this->setConfigTypeSelect($form, $settings['types']['config'], $this->t('exclude'), FALSE, $this->t("Select types of configuration that should be excluded from packaging.")); - $form['curated'] = array( + $form['curated'] = [ '#type' => 'checkbox', '#title' => $this->t('Exclude designated site-specific configuration'), '#default_value' => $curated_settings, '#description' => $this->t('Select this option to exclude a curated list of site-specific configuration from packaging.'), - ); + ]; - $form['module'] = array( + $form['module'] = [ '#type' => 'fieldset', '#tree' => TRUE, '#title' => $this->t('Exclude configuration provided by modules'), - ); + ]; - $form['module']['installed'] = array( + $form['module']['installed'] = [ '#type' => 'checkbox', '#title' => $this->t('Exclude installed module-provided entity configuration'), '#default_value' => $module_settings['installed'], '#description' => $this->t('Select this option to exclude configuration provided by INSTALLED modules from reassignment.'), - '#attributes' => array( + '#attributes' => [ 'data-module-installed' => 'status', - ), - ); + ], + ]; - $show_if_module_installed_checked = array( - 'visible' => array( - ':input[data-module-installed="status"]' => array('checked' => TRUE), - ), - ); + $show_if_module_installed_checked = [ + 'visible' => [ + ':input[data-module-installed="status"]' => ['checked' => TRUE], + ], + ]; $info = system_get_info('module', drupal_get_profile()); - $form['module']['profile'] = array( + $form['module']['profile'] = [ '#type' => 'checkbox', '#title' => $this->t("Don't exclude install profile's configuration"), '#default_value' => $module_settings['profile'], - '#description' => $this->t("Select this option to allow configuration provided by the site's install profile (%profile) to be reassigned.", array('%profile' => $info['name'])), + '#description' => $this->t("Select this option to allow configuration provided by the site's install profile (%profile) to be reassigned.", ['%profile' => $info['name']]), '#states' => $show_if_module_installed_checked, - ); + ]; $bundle_name = $this->currentBundle->getMachineName(); $bundle_name = !empty($bundle_name) ? $bundle_name : $this->t('none'); - $form['module']['namespace'] = array( + $form['module']['namespace'] = [ '#type' => 'checkbox', '#title' => $this->t("Don't exclude non-installed configuration by namespace"), '#default_value' => $module_settings['namespace'], - '#description' => $this->t("Select this option to allow configuration provided by uninstalled modules with the bundle namespace (%namespace_*) to be reassigned.", array('%namespace' => $bundle_name)), + '#description' => $this->t("Select this option to allow configuration provided by uninstalled modules with the bundle namespace (%namespace_*) to be reassigned.", ['%namespace' => $bundle_name]), '#states' => $show_if_module_installed_checked, - '#attributes' => array( + '#attributes' => [ 'data-namespace' => 'status', - ), - ); + ], + ]; - $show_if_namespace_checked = array( - 'visible' => array( - ':input[data-namespace="status"]' => array('checked' => TRUE), - ':input[data-module-installed="status"]' => array('checked' => TRUE), - ), - ); + $show_if_namespace_checked = [ + 'visible' => [ + ':input[data-namespace="status"]' => ['checked' => TRUE], + ':input[data-module-installed="status"]' => ['checked' => TRUE], + ], + ]; - $form['module']['namespace_any'] = array( + $form['module']['namespace_any'] = [ '#type' => 'checkbox', '#title' => $this->t("Don't exclude ANY configuration by namespace"), '#default_value' => $module_settings['namespace_any'], '#description' => $this->t("Select this option to allow configuration provided by ANY modules with the bundle namespace (%namespace_*) to be reassigned. - Warning: Can cause installed configuration to be reassigned to different packages.", array('%namespace' => $bundle_name)), + Warning: Can cause installed configuration to be reassigned to different packages.", ['%namespace' => $bundle_name]), '#states' => $show_if_namespace_checked, - ); + ]; $this->setActions($form, self::METHOD_ID); diff --git a/web/modules/features/modules/features_ui/src/Form/AssignmentFormBase.php b/web/modules/features/modules/features_ui/src/Form/AssignmentFormBase.php index 9756c3cfd5..9b7dca9279 100644 --- a/web/modules/features/modules/features_ui/src/Form/AssignmentFormBase.php +++ b/web/modules/features/modules/features_ui/src/Form/AssignmentFormBase.php @@ -77,19 +77,19 @@ protected function setConfigTypeSelect(&$form, $defaults, $type, $bundles_only = $options = $this->featuresManager->listConfigTypes($bundles_only); if (!isset($form['types'])) { - $form['types'] = array( + $form['types'] = [ '#type' => 'container', '#tree' => TRUE, - ); + ]; } - $form['types']['config'] = array( + $form['types']['config'] = [ '#type' => 'checkboxes', '#title' => $this->t('Configuration types'), - '#description' => !empty($description) ? $description : $this->t('Select types of configuration that should be considered @type types.', array('@type' => $type)), + '#description' => !empty($description) ? $description : $this->t('Select types of configuration that should be considered @type types.', ['@type' => $type]), '#options' => $options, '#default_value' => $defaults, - ); + ]; } /** @@ -98,13 +98,13 @@ protected function setConfigTypeSelect(&$form, $defaults, $type, $bundles_only = protected function setContentTypeSelect(&$form, $defaults, $type, $exclude_has_config_bundles = TRUE) { $entity_types = $this->entityTypeManager->getDefinitions(); - $has_config_bundle = array(); + $has_config_bundle = []; foreach ($entity_types as $definition) { if ($entity_type_id = $definition->getBundleOf()) { $has_config_bundle[] = $entity_type_id; } } - $options = array(); + $options = []; foreach ($entity_types as $entity_type_id => $entity_type) { if (!$entity_type instanceof ContentEntityTypeInterface) { @@ -120,19 +120,19 @@ protected function setContentTypeSelect(&$form, $defaults, $type, $exclude_has_c uasort($options, 'strnatcasecmp'); if (!isset($form['types'])) { - $form['types'] = array( + $form['types'] = [ '#type' => 'container', '#tree' => TRUE, - ); + ]; } - $form['types']['content'] = array( + $form['types']['content'] = [ '#type' => 'checkboxes', '#title' => $this->t('Content entity types'), - '#description' => $this->t('Select content entity types that should be considered @type types.', array('@type' => $type)), + '#description' => $this->t('Select content entity types that should be considered @type types.', ['@type' => $type]), '#options' => $options, '#default_value' => $defaults, - ); + ]; } /** @@ -142,25 +142,25 @@ protected function setActions(&$form, $method_id = NULL) { $assignment_info = $this->assigner->getAssignmentMethods(); if (isset($method_id) && isset($assignment_info[$method_id])) { $method = $assignment_info[$method_id]; - $form['help_text'] = array( + $form['help_text'] = [ '#markup' => $method['description'], '#prefix' => '<p class="messages messages--status">', '#suffix' => '</p>', '#weight' => -99, - ); + ]; } - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( + $form['actions'] = ['#type' => 'actions']; + $form['actions']['submit'] = [ '#type' => 'submit', '#button_type' => 'primary', '#value' => $this->t('Save settings'), - ); + ]; $form['#attributes']['class'][] = 'features-assignment-settings-form'; - $form['#attached'] = array( - 'library' => array( + $form['#attached'] = [ + 'library' => [ 'features_ui/drupal.features_ui.admin', - )); + ]]; } /** @@ -170,7 +170,7 @@ protected function setActions(&$form, $method_id = NULL) { * The form state. */ protected function setRedirect(FormStateInterface $form_state) { - $form_state->setRedirect('features.assignment', array('bundle_name' => $this->currentBundle->getMachineName())); + $form_state->setRedirect('features.assignment', ['bundle_name' => $this->currentBundle->getMachineName()]); } } diff --git a/web/modules/features/modules/features_ui/src/Form/AssignmentProfileForm.php b/web/modules/features/modules/features_ui/src/Form/AssignmentProfileForm.php index 2a4b17797a..88c86348dd 100644 --- a/web/modules/features/modules/features_ui/src/Form/AssignmentProfileForm.php +++ b/web/modules/features/modules/features_ui/src/Form/AssignmentProfileForm.php @@ -27,32 +27,32 @@ public function buildForm(array $form, FormStateInterface $form_state, $bundle_n $this->setConfigTypeSelect($form, $settings['types']['config'], $this->t('profile')); - $form['curated'] = array( + $form['curated'] = [ '#type' => 'checkbox', '#title' => $this->t('Add commonly-needed configuration'), '#default_value' => $settings['curated'], '#description' => $this->t('Select this option to add a curated list of commonly-needed configuration including cron- and theme-related settings to the install profile.'), - ); + ]; $standard_settings = $settings['standard']; - $form['standard'] = array( + $form['standard'] = [ '#type' => 'fieldset', '#title' => $this->t('Crib from the Standard profile'), '#tree' => TRUE, - ); - $form['standard']['files'] = array( + ]; + $form['standard']['files'] = [ '#type' => 'checkbox', '#title' => $this->t('Crib code'), '#default_value' => $standard_settings['files'], '#description' => $this->t('Select this option to add configuration and other files to the optional install profile from the Drupal core Standard install profile. Without these additions, a generated install profile will be missing some important initial setup.'), - ); - $form['standard']['dependencies'] = array( + ]; + $form['standard']['dependencies'] = [ '#type' => 'checkbox', '#title' => $this->t('Crib dependencies'), '#default_value' => $standard_settings['dependencies'], '#description' => $this->t('Select this option to add module and theme dependencies from the Standard install profile.'), - ); + ]; $this->setActions($form, self::METHOD_ID); diff --git a/web/modules/features/modules/features_ui/src/Form/FeaturesDiffForm.php b/web/modules/features/modules/features_ui/src/Form/FeaturesDiffForm.php index 68cc0e9daa..b04ca241a9 100644 --- a/web/modules/features/modules/features_ui/src/Form/FeaturesDiffForm.php +++ b/web/modules/features/modules/features_ui/src/Form/FeaturesDiffForm.php @@ -99,70 +99,70 @@ public function getFormId() { public function buildForm(array $form, FormStateInterface $form_state, $featurename = '') { $current_bundle = $this->assigner->applyBundle(); $packages = $this->featuresManager->getPackages(); - $form = array(); + $form = []; $machine_name = ''; if (!empty($featurename) && empty($packages[$featurename])) { - drupal_set_message($this->t('Feature @name does not exist.', array('@name' => $featurename)), 'error'); - return array(); + drupal_set_message($this->t('Feature @name does not exist.', ['@name' => $featurename]), 'error'); + return []; } elseif (!empty($featurename)) { $machine_name = $packages[$featurename]->getMachineName(); - $packages = array($packages[$featurename]); + $packages = [$packages[$featurename]]; } else { $packages = $this->featuresManager->filterPackages($packages, $current_bundle->getMachineName()); } - $header = array( - 'row' => array( + $header = [ + 'row' => [ 'data' => !empty($machine_name) - ? $this->t('Differences in @name', array('@name' => $machine_name)) - : ($current_bundle->isDefault() ? $this->t('All differences') : $this->t('All differences in bundle: @bundle', array('@bundle' => $current_bundle->getName()))), - ), - ); + ? $this->t('Differences in @name', ['@name' => $machine_name]) + : ($current_bundle->isDefault() ? $this->t('All differences') : $this->t('All differences in bundle: @bundle', ['@bundle' => $current_bundle->getName()])), + ], + ]; - $options = array(); + $options = []; foreach ($packages as $package) { if ($package->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT) { $missing = $this->featuresManager->reorderMissing($this->featuresManager->detectMissing($package)); $overrides = $this->featuresManager->detectOverrides($package, TRUE); if (!empty($overrides) || !empty($missing)) { - $options += array( - $package->getMachineName() => array( - 'row' => array( - 'data' => array( + $options += [ + $package->getMachineName() => [ + 'row' => [ + 'data' => [ '#type' => 'html_tag', '#tag' => 'h2', '#value' => Html::escape($package->getName()), - ), - ), - '#attributes' => array( + ], + ], + '#attributes' => [ 'class' => 'features-diff-header', - ), - ), - ); + ], + ], + ]; $options += $this->diffOutput($package, $overrides, $missing); } } } - $form['diff'] = array( + $form['diff'] = [ '#type' => 'tableselect', '#header' => $header, '#options' => $options, - '#attributes' => array('class' => array('features-diff-listing')), + '#attributes' => ['class' => ['features-diff-listing']], '#empty' => $this->t('No differences exist in exported features.'), - ); + ]; - $form['actions'] = array('#type' => 'actions', '#tree' => TRUE); - $form['actions']['revert'] = array( + $form['actions'] = ['#type' => 'actions', '#tree' => TRUE]; + $form['actions']['revert'] = [ '#type' => 'submit', '#value' => $this->t('Import changes'), - ); - $form['actions']['help'] = array( + ]; + $form['actions']['help'] = [ '#markup' => $this->t('Import the selected changes above into the active configuration.'), - ); + ]; $form['#attached']['library'][] = 'system/diff'; $form['#attached']['library'][] = 'features_ui/drupal.features_ui.admin'; @@ -192,7 +192,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); $this->configRevert->import($type, $item['name_short']); } - drupal_set_message($this->t('Imported @name', array('@name' => $config_name))); + drupal_set_message($this->t('Imported @name', ['@name' => $config_name])); } } @@ -209,59 +209,59 @@ public function submitForm(array &$form, FormStateInterface $form_state) { * @return array * A form element. */ - protected function diffOutput(Package $package, $overrides, $missing = array()) { - $element = array(); + protected function diffOutput(Package $package, $overrides, $missing = []) { + $element = []; $config = $this->featuresManager->getConfigCollection(); $components = array_merge($missing, $overrides); - $header = array( - array('data' => '', 'class' => 'diff-marker'), - array('data' => $this->t('Active site config'), 'class' => 'diff-context'), - array('data' => '', 'class' => 'diff-marker'), - array('data' => $this->t('Feature code config'), 'class' => 'diff-context'), - ); + $header = [ + ['data' => '', 'class' => 'diff-marker'], + ['data' => $this->t('Active site config'), 'class' => 'diff-context'], + ['data' => '', 'class' => 'diff-marker'], + ['data' => $this->t('Feature code config'), 'class' => 'diff-context'], + ]; foreach ($components as $name) { - $rows[] = array(array('data' => $name, 'colspan' => 4, 'header' => TRUE)); + $rows[] = [['data' => $name, 'colspan' => 4, 'header' => TRUE]]; if (!isset($config[$name])) { - $details = array( + $details = [ '#markup' => $this->t('Component in feature missing from active config.'), - ); + ]; } else { $active = $this->featuresManager->getActiveStorage()->read($name); $extension = $this->featuresManager->getExtensionStorages()->read($name); if (empty($extension)) { - $details = array( + $details = [ '#markup' => $this->t('Dependency detected in active config but not exported to the feature.'), - ); + ]; } else { $diff = $this->configDiff->diff($active, $extension); - $details = array( + $details = [ '#type' => 'table', '#header' => $header, '#rows' => $this->diffFormatter->format($diff), - '#attributes' => array('class' => array('diff', 'features-diff')), - ); + '#attributes' => ['class' => ['diff', 'features-diff']], + ]; } } - $element[$name] = array( - 'row' => array( - 'data' => array( + $element[$name] = [ + 'row' => [ + 'data' => [ '#type' => 'details', '#title' => Html::escape($name), '#open' => TRUE, - '#description' => array( + '#description' => [ 'data' => $details, - ), - ), - ), - '#attributes' => array( + ], + ], + ], + '#attributes' => [ 'class' => 'diff-' . $package->getMachineName(), - ), - ); + ], + ]; } return $element; diff --git a/web/modules/features/modules/features_ui/src/Form/FeaturesEditForm.php b/web/modules/features/modules/features_ui/src/Form/FeaturesEditForm.php index ae52e26136..6280876576 100644 --- a/web/modules/features/modules/features_ui/src/Form/FeaturesEditForm.php +++ b/web/modules/features/modules/features_ui/src/Form/FeaturesEditForm.php @@ -180,7 +180,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $featuren $packages = $this->featuresManager->getPackages(); if (empty($packages[$featurename])) { - $featurename = str_replace(array('-', ' '), '_', $featurename); + $featurename = str_replace(['-', ' '], '_', $featurename); $this->package = $this->featuresManager->initPackage($featurename, NULL, '', 'module', $bundle); } else { @@ -202,107 +202,107 @@ public function buildForm(array $form, FormStateInterface $form_state, $featuren $this->package = $packages[$featurename]; } - $form = array( + $form = [ '#show_operations' => FALSE, '#prefix' => '<div id="features-edit-wrapper">', '#suffix' => '</div>', - ); + ]; - $form['info'] = array( + $form['info'] = [ '#type' => 'fieldset', '#title' => $this->t('General Information'), '#tree' => FALSE, '#weight' => 2, '#prefix' => "<div id='features-export-info'>", '#suffix' => '</div>', - ); + ]; - $form['info']['name'] = array( + $form['info']['name'] = [ '#title' => $this->t('Name'), '#description' => $this->t('Example: Image gallery') . ' (' . $this->t('Do not begin name with numbers.') . ')', '#type' => 'textfield', '#default_value' => $this->package->getName(), - ); + ]; if (!$bundle->isDefault()) { $form['info']['name']['#description'] .= '<br/>' . - $this->t('The namespace "@name_" will be prepended to the machine name', array('@name' => $bundle->getMachineName())); + $this->t('The namespace "@name_" will be prepended to the machine name', ['@name' => $bundle->getMachineName()]); } - $form['info']['machine_name'] = array( + $form['info']['machine_name'] = [ '#type' => 'machine_name', '#title' => $this->t('Machine-readable name'), '#description' => $this->t('Example: image_gallery') . ' ' . $this->t('May only contain lowercase letters, numbers and underscores.'), '#required' => TRUE, '#default_value' => $bundle->getShortName($this->package->getMachineName()), - '#machine_name' => array( - 'source' => array('info', 'name'), - 'exists' => array($this, 'featureExists'), - ), - ); + '#machine_name' => [ + 'source' => ['info', 'name'], + 'exists' => [$this, 'featureExists'], + ], + ]; if (!$bundle->isDefault()) { $form['info']['machine_name']['#description'] .= '<br/>' . - $this->t('NOTE: Do NOT include the namespace prefix "@name_"; it will be added automatically.', array('@name' => $bundle->getMachineName())); + $this->t('NOTE: Do NOT include the namespace prefix "@name_"; it will be added automatically.', ['@name' => $bundle->getMachineName()]); } - $form['info']['description'] = array( + $form['info']['description'] = [ '#title' => $this->t('Description'), '#description' => $this->t('Provide a short description of what users should expect when they install your feature.'), '#type' => 'textarea', '#rows' => 3, '#default_value' => $this->package->getDescription(), - ); + ]; - $form['info']['package'] = array( + $form['info']['package'] = [ '#title' => $this->t('Bundle'), '#type' => 'select', '#options' => $this->assigner->getBundleOptions(), '#default_value' => $bundle->getMachineName(), - '#ajax' => array( + '#ajax' => [ 'callback' => '::updateBundle', 'wrapper' => 'features-export-info', - ), - ); + ], + ]; - $form['info']['version'] = array( + $form['info']['version'] = [ '#title' => $this->t('Version'), '#description' => $this->t('Examples: 8.x-1.0, 8.x-1.0-beta1'), '#type' => 'textfield', '#required' => FALSE, '#default_value' => $this->package->getVersion(), '#size' => 30, - ); + ]; list($full_name, $path) = $this->featuresManager->getExportInfo($this->package, $bundle); - $form['info']['directory'] = array( + $form['info']['directory'] = [ '#title' => $this->t('Path'), '#description' => $this->t('Path to export package using Write action, relative to root directory.'), '#type' => 'textfield', '#required' => FALSE, '#default_value' => $path, '#size' => 30, - ); + ]; $require_all = $this->package->getRequiredAll(); - $form['info']['require_all'] = array( + $form['info']['require_all'] = [ '#type' => 'checkbox', '#title' => $this->t('Mark all config as required'), '#default_value' => $this->package->getRequiredAll(), '#description' => $this->t('Required config will be assigned to this feature regardless of other assignment plugins.'), - ); + ]; - $form['conflicts'] = array( + $form['conflicts'] = [ '#type' => 'checkbox', '#title' => $this->t('Allow conflicts'), '#default_value' => $this->allowConflicts, '#description' => $this->t('Allow configuration to be exported to more than one feature.'), '#weight' => 8, - '#ajax' => array( + '#ajax' => [ 'callback' => '::updateForm', 'wrapper' => 'features-edit-wrapper', - ), - ); + ], + ]; - $generation_info = array(); + $generation_info = []; if (\Drupal::currentUser()->hasPermission('export configuration')) { // Offer available generation methods. $generation_info = $this->generator->getGenerationMethods(); @@ -310,16 +310,16 @@ public function buildForm(array $form, FormStateInterface $form_state, $featuren uasort($generation_info, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); } - $form['actions'] = array('#type' => 'actions', '#tree' => TRUE); + $form['actions'] = ['#type' => 'actions', '#tree' => TRUE]; foreach ($generation_info as $method_id => $method) { - $form['actions'][$method_id] = array( + $form['actions'][$method_id] = [ '#type' => 'submit', '#name' => $method_id, - '#value' => $this->t('@name', array('@name' => $method['name'])), - '#attributes' => array( + '#value' => $this->t('@name', ['@name' => $method['name']]), + '#attributes' => [ 'title' => Html::escape($method['description']), - ), - ); + ], + ]; } // Build the Component Listing panel on the right. @@ -342,29 +342,29 @@ public function buildForm(array $form, FormStateInterface $form_state, $featuren $this->t('Or, enable the Allow Conflicts option above.') . '</strong>'; } - $form['actions']['import_missing'] = array( + $form['actions']['import_missing'] = [ '#type' => 'submit', '#name' => 'import_missing', '#value' => $this->t('Import Missing'), - '#attributes' => array( + '#attributes' => [ 'title' => $this->t('Import only the missing configuration items.'), - ), - ); + ], + ]; } - $form['#attached'] = array( - 'library' => array( + $form['#attached'] = [ + 'library' => [ 'features_ui/drupal.features_ui.admin', - ), - 'drupalSettings' => array( - 'features' => array( + ], + 'drupalSettings' => [ + 'features' => [ 'excluded' => $this->excluded, 'required' => $this->required, 'conflicts' => $this->conflicts, 'autodetect' => TRUE, - ), - ), - ); + ], + ], + ]; return $form; } @@ -414,7 +414,7 @@ public function featureExists($value, $element, $form_state) { * form. */ protected function buildComponentList(FormStateInterface $form_state) { - $element = array( + $element = [ '#type' => 'fieldset', '#title' => $this->t('Components'), '#description' => $this->t('Expand each component section and select which items should be included in this feature export.'), @@ -422,35 +422,35 @@ protected function buildComponentList(FormStateInterface $form_state) { '#prefix' => "<div id='features-export-wrapper'>", '#suffix' => '</div>', '#weight' => 1, - ); + ]; // Filter field used in javascript, so javascript will unhide it. - $element['features_filter_wrapper'] = array( + $element['features_filter_wrapper'] = [ '#type' => 'fieldset', '#title' => $this->t('Filters'), '#tree' => FALSE, '#prefix' => "<div id='features-filter' class='element-invisible'>", '#suffix' => '</div>', '#weight' => -10, - ); - $element['features_filter_wrapper']['features_filter'] = array( + ]; + $element['features_filter_wrapper']['features_filter'] = [ '#type' => 'textfield', '#title' => $this->t('Search'), '#hidden' => TRUE, '#default_value' => '', '#suffix' => "<span class='features-filter-clear'>" . $this->t('Clear') . "</span>", - ); - $element['features_filter_wrapper']['checkall'] = array( + ]; + $element['features_filter_wrapper']['checkall'] = [ '#type' => 'checkbox', '#default_value' => FALSE, '#hidden' => TRUE, '#title' => $this->t('Select all'), - '#attributes' => array( - 'class' => array('features-checkall'), - ), - ); + '#attributes' => [ + 'class' => ['features-checkall'], + ], + ]; - $sections = array('included', 'detected', 'added'); + $sections = ['included', 'detected', 'added']; $config_types = $this->featuresManager->listConfigTypes(); // Generate the export array for the current feature and user selections. @@ -460,10 +460,10 @@ protected function buildComponentList(FormStateInterface $form_state) { $component_items_count = count($component_info['_features_options']['sources']); $label = new FormattableMarkup('@component (<span class="component-count">@count</span>)', - array( + [ '@component' => $config_types[$component], '@count' => $component_items_count, - ) + ] ); $count = 0; @@ -474,76 +474,76 @@ protected function buildComponentList(FormStateInterface $form_state) { $component_name = str_replace('_', '-', Html::escape($component)); if ($count + $component_items_count > 0) { - $element[$component] = array( + $element[$component] = [ '#markup' => '', '#tree' => TRUE, - ); + ]; - $element[$component]['sources'] = array( + $element[$component]['sources'] = [ '#type' => 'details', '#title' => $label, '#tree' => TRUE, '#open' => FALSE, - '#attributes' => array('class' => array('features-export-component')), + '#attributes' => ['class' => ['features-export-component']], '#prefix' => "<div class='features-export-parent component-$component'>", - ); - $element[$component]['sources']['selected'] = array( + ]; + $element[$component]['sources']['selected'] = [ '#type' => 'checkboxes', '#id' => "edit-sources-$component_name", '#options' => $this->domDecodeOptions($component_info['_features_options']['sources']), '#default_value' => $this->domDecodeOptions($component_info['_features_selected']['sources'], FALSE), - '#attributes' => array('class' => array('component-select')), + '#attributes' => ['class' => ['component-select']], '#prefix' => "<span class='component-select'>", '#suffix' => '</span>', - ); + ]; - $element[$component]['before-list'] = array( + $element[$component]['before-list'] = [ '#markup' => "<div class='component-list features-export-list $extra_class'>", - ); + ]; foreach ($sections as $section) { - $element[$component][$section] = array( + $element[$component][$section] = [ '#type' => 'checkboxes', '#options' => !empty($component_info['_features_options'][$section]) ? - $this->domDecodeOptions($component_info['_features_options'][$section]) : array(), + $this->domDecodeOptions($component_info['_features_options'][$section]) : [], '#default_value' => !empty($component_info['_features_selected'][$section]) ? - $this->domDecodeOptions($component_info['_features_selected'][$section], FALSE) : array(), - '#attributes' => array('class' => array('component-' . $section)), + $this->domDecodeOptions($component_info['_features_selected'][$section], FALSE) : [], + '#attributes' => ['class' => ['component-' . $section]], '#prefix' => "<span class='component-$section'>", '#suffix' => '</span>', - ); + ]; } // Close both the before-list as well as the sources div. - $element[$component]['after-list'] = array( + $element[$component]['after-list'] = [ '#markup' => "</div></div>", - ); + ]; } } - $element['features_missing'] = array( + $element['features_missing'] = [ '#theme' => 'item_list', '#items' => $export['missing'], '#title' => $this->t('Configuration missing from active site:'), '#suffix' => '<div class="description">' . $this->t('Import the feature to create the missing config listed above.') . '</div>', - ); + ]; - $element['features_legend'] = array( + $element['features_legend'] = [ '#type' => 'fieldset', '#title' => $this->t('Legend'), '#tree' => FALSE, '#prefix' => "<div id='features-legend'>", '#suffix' => '</div>', - ); - $element['features_legend']['legend'] = array( + ]; + $element['features_legend']['legend'] = [ '#markup' => "<span class='component-included'>" . $this->t('Normal') . "</span> " . "<span class='component-added'>" . $this->t('Added') . "</span> " . "<span class='component-detected'>" . $this->t('Auto detected') . "</span> " . "<span class='component-conflict'>" . $this->t('Conflict') . "</span> ", - ); + ]; return $element; } @@ -604,8 +604,8 @@ protected function getComponentList(FormStateInterface $form_state) { $this->package = $packages[$package_name]; // Make a map of all config data. - $components = array(); - $this->conflicts = array(); + $components = []; + $this->conflicts = []; foreach ($config as $item_name => $item) { if (($item->getPackage() != $package_name) && !empty($packages[$item->getPackage()]) && ($packages[$item->getPackage()]->getStatus() != FeaturesManagerInterface::STATUS_NO_EXPORT)) { @@ -619,8 +619,8 @@ protected function getComponentList(FormStateInterface $form_state) { } // Make a map of the config data already exported to the Feature. - $this->missing = array(); - $exported_features_info = array(); + $this->missing = []; + $exported_features_info = []; foreach ($this->package->getConfigOrig() as $item_name) { // Make sure the extension provided item exists in the active // configuration storage. @@ -638,9 +638,9 @@ protected function getComponentList(FormStateInterface $form_state) { $exported_features_info['dependencies'] = $this->package->getDependencyInfo(); // Make a map of any config specifically excluded and/or required. - foreach (array('excluded', 'required') as $constraint) { - $this->{$constraint} = array(); - $info = !empty($this->package->{'get' . $constraint}()) ? $this->package->{'get' . $constraint}() : array(); + foreach (['excluded', 'required'] as $constraint) { + $this->{$constraint} = []; + $info = !empty($this->package->{'get' . $constraint}()) ? $this->package->{'get' . $constraint}() : []; // $info may be boolean. if (is_array($info)) { foreach ($info as $item_name) { @@ -654,7 +654,7 @@ protected function getComponentList(FormStateInterface $form_state) { } // Make a map of the config data to be exported within the Feature. - $new_features_info = array(); + $new_features_info = []; foreach ($this->package->getConfig() as $item_name) { $item = $config[$item_name]; $new_features_info[$item->getType()][$item->getShortName()] = $item->getLabel(); @@ -662,29 +662,29 @@ protected function getComponentList(FormStateInterface $form_state) { $new_features_info['dependencies'] = $this->package->getDependencies(); // Assemble the combined component list. - $config_new = array(); - $sections = array('sources', 'included', 'detected', 'added'); + $config_new = []; + $sections = ['sources', 'included', 'detected', 'added']; // Generate list of config to be exported. - $config_count = array(); + $config_count = []; foreach ($components as $component => $component_info) { // User-selected components take precedence. - $config_new[$component] = array(); + $config_new[$component] = []; $config_count[$component] = 0; // Add selected items from Sources checkboxes. - if (!$form_state->isValueEmpty(array($component, 'sources', 'selected'))) { - $config_new[$component] = array_merge($config_new[$component], $this->domDecodeOptions(array_filter($form_state->getValue(array( + if (!$form_state->isValueEmpty([$component, 'sources', 'selected'])) { + $config_new[$component] = array_merge($config_new[$component], $this->domDecodeOptions(array_filter($form_state->getValue([ $component, 'sources', 'selected', - ))))); + ])))); $config_count[$component]++; } // Add selected items from already Included, newly Added, auto-detected // checkboxes. - foreach (array('included', 'added', 'detected') as $section) { - if (!$form_state->isValueEmpty(array($component, $section))) { - $config_new[$component] = array_merge($config_new[$component], $this->domDecodeOptions(array_filter($form_state->getValue(array($component, $section))))); + foreach (['included', 'added', 'detected'] as $section) { + if (!$form_state->isValueEmpty([$component, $section])) { + $config_new[$component] = array_merge($config_new[$component], $this->domDecodeOptions(array_filter($form_state->getValue([$component, $section])))); $config_count[$component]++; } } @@ -710,19 +710,19 @@ protected function getComponentList(FormStateInterface $form_state) { foreach ($components as $component => $component_info) { $component_export = $component_info; foreach ($sections as $section) { - $component_export['_features_options'][$section] = array(); - $component_export['_features_selected'][$section] = array(); + $component_export['_features_options'][$section] = []; + $component_export['_features_selected'][$section] = []; } if (!empty($component_info)) { - $exported_components = !empty($exported_features_info[$component]) ? $exported_features_info[$component] : array(); - $new_components = !empty($new_features_info[$component]) ? $new_features_info[$component] : array(); + $exported_components = !empty($exported_features_info[$component]) ? $exported_features_info[$component] : []; + $new_components = !empty($new_features_info[$component]) ? $new_features_info[$component] : []; foreach ($component_info as $key => $label) { $config_name = $this->featuresManager->getFullName($component, $key); // If checkbox in Sources is checked, move it to Added section. - if (!$form_state->isValueEmpty(array($component, 'sources', 'selected', $key))) { - $form_state->setValue(array($component, 'sources', 'selected', $key), FALSE); - $form_state->setValue(array($component, 'added', $key), 1); + if (!$form_state->isValueEmpty([$component, 'sources', 'selected', $key])) { + $form_state->setValue([$component, 'sources', 'selected', $key], FALSE); + $form_state->setValue([$component, 'added', $key], 1); $component_export['_features_options']['added'][$key] = $this->configLabel($component, $key, $label); $component_export['_features_selected']['added'][$key] = $key; // If this was previously excluded, we don't need to set it as @@ -746,8 +746,8 @@ protected function getComponentList(FormStateInterface $form_state) { // means it was an auto-detect that was previously part of the // export and is now de-selected in UI. if ($form_state->isSubmitted() && - ($form_state->hasValue(array($component, 'included', $key)) || - ($form_state->isValueEmpty(array($component, 'detected', $key)))) && + ($form_state->hasValue([$component, 'included', $key]) || + ($form_state->isValueEmpty([$component, 'detected', $key]))) && empty($config_new[$component][$key])) { $section = 'detected'; $default_value = FALSE; @@ -755,9 +755,9 @@ protected function getComponentList(FormStateInterface $form_state) { // Unless it's unchecked in the form, then move it to Newly // disabled item. elseif ($form_state->isSubmitted() && - $form_state->isValueEmpty(array($component, 'added', $key)) && - $form_state->isValueEmpty(array($component, 'detected', $key)) && - $form_state->isValueEmpty(array($component, 'included', $key))) { + $form_state->isValueEmpty([$component, 'added', $key]) && + $form_state->isValueEmpty([$component, 'detected', $key]) && + $form_state->isValueEmpty([$component, 'included', $key])) { $section = 'added'; $default_value = FALSE; } @@ -777,16 +777,16 @@ protected function getComponentList(FormStateInterface $form_state) { // If it's already checked in Added or Sources, leave it in Added // as checked. if ($form_state->isSubmitted() && - (!$form_state->isValueEmpty(array($component, 'added', $key)) || - !$form_state->isValueEmpty(array($component, 'sources', 'selected', $key)))) { + (!$form_state->isValueEmpty([$component, 'added', $key]) || + !$form_state->isValueEmpty([$component, 'sources', 'selected', $key]))) { $section = 'added'; $default_value = $key; } // If it's already been unchecked, leave it unchecked. elseif ($form_state->isSubmitted() && - $form_state->isValueEmpty(array($component, 'sources', 'selected', $key)) && - $form_state->isValueEmpty(array($component, 'detected', $key)) && - !$form_state->hasValue(array($component, 'added', $key))) { + $form_state->isValueEmpty([$component, 'sources', 'selected', $key]) && + $form_state->isValueEmpty([$component, 'detected', $key]) && + !$form_state->hasValue([$component, 'added', $key])) { $section = 'detected'; $default_value = FALSE; } @@ -817,10 +817,10 @@ protected function getComponentList(FormStateInterface $form_state) { // at 'input'. if ($form_state->isSubmitted()) { if (!$default_value) { - $form_state->setValue(array($component, $section, $key), FALSE); + $form_state->setValue([$component, $section, $key], FALSE); } else { - $form_state->setValue(array($component, $section, $key), 1); + $form_state->setValue([$component, $section, $key], 1); } } } @@ -833,9 +833,9 @@ protected function getComponentList(FormStateInterface $form_state) { else { // Option was not part of the new export. $added = FALSE; - foreach (array('included', 'added') as $section) { + foreach (['included', 'added'] as $section) { // Restore any user-selected checkboxes. - if (!$form_state->isValueEmpty(array($component, $section, $key))) { + if (!$form_state->isValueEmpty([$component, $section, $key])) { $component_export['_features_options'][$section][$key] = $this->configLabel($component, $key, $label); $component_export['_features_selected'][$section][$key] = $key; $added = TRUE; @@ -927,12 +927,12 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } // Set default redirect, but allow generators to change it later. - $form_state->setRedirect('features.edit', array('featurename' => $this->package->getMachineName())); + $form_state->setRedirect('features.edit', ['featurename' => $this->package->getMachineName()]); if ($method_id == 'import_missing') { $this->importMissing(); } elseif (!empty($method_id)) { - $packages = array($this->package->getMachineName()); + $packages = [$this->package->getMachineName()]; $this->generator->generatePackages($method_id, $bundle, $packages); $this->generator->applyExportFormSubmit($method_id, $form, $form_state); } @@ -947,7 +947,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { * Config array to be exported. */ protected function updatePackageConfig(FormStateInterface $form_state) { - $config = array(); + $config = []; $components = $this->getComponentList($form_state); foreach ($components['config_new'] as $config_type => $items) { foreach ($items as $name) { @@ -969,10 +969,10 @@ protected function importMissing() { $type = ConfigurationItem::fromConfigStringToConfigType($item['type']); try { $this->configRevert->import($type, $item['name_short']); - drupal_set_message($this->t('Imported @name', array('@name' => $config_name))); + drupal_set_message($this->t('Imported @name', ['@name' => $config_name])); } catch (\Exception $e) { drupal_set_message($this->t('Error importing @name : @message', - array('@name' => $config_name, '@message' => $e->getMessage())), 'error'); + ['@name' => $config_name, '@message' => $e->getMessage()]), 'error'); } } } @@ -1010,7 +1010,7 @@ protected function updateRequired() { * suitable for storing in the info.yml file. */ protected function updateConstrained($constraint) { - $constrained = array(); + $constrained = []; foreach ($this->{$constraint} as $type => $item) { foreach ($item as $name => $value) { $constrained[] = $this->featuresManager->getFullName($type, $name); @@ -1061,7 +1061,7 @@ protected function domDecode($key) { */ protected function domDecodeOptions(array $options, $keys_only = FALSE) { $replacements = array_flip($this->domEncodeMap()); - $encoded = array(); + $encoded = []; foreach ($options as $key => $value) { $encoded[strtr($key, $replacements)] = $keys_only ? $value : strtr($value, $replacements); } @@ -1075,7 +1075,7 @@ protected function domDecodeOptions(array $options, $keys_only = FALSE) { * An encoding map. */ protected function domEncodeMap() { - return array( + return [ ':' => '__' . ord(':') . '__', '/' => '__' . ord('/') . '__', ',' => '__' . ord(',') . '__', @@ -1085,7 +1085,7 @@ protected function domEncodeMap() { '%' => '__' . ord('%') . '__', ')' => '__' . ord(')') . '__', '(' => '__' . ord('(') . '__', - ); + ]; } } diff --git a/web/modules/features/modules/features_ui/src/Form/FeaturesExportForm.php b/web/modules/features/modules/features_ui/src/Form/FeaturesExportForm.php index d2ffeedd38..bed30b10e9 100644 --- a/web/modules/features/modules/features_ui/src/Form/FeaturesExportForm.php +++ b/web/modules/features/modules/features_ui/src/Form/FeaturesExportForm.php @@ -139,10 +139,10 @@ public function buildForm(array $form, FormStateInterface $form_state) { // callback. $form['#packages'] = $packages; $form['#profile_package'] = $current_bundle->getProfileName(); - $form['header'] = array( + $form['header'] = [ '#type' => 'container', - '#attributes' => array('class' => 'features-header'), - ); + '#attributes' => ['class' => 'features-header'], + ]; $bundle_options = $this->assigner->getBundleOptions(); @@ -153,29 +153,29 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['#prefix'] = '<div id="edit-features-wrapper">'; $form['#suffix'] = '</div>'; - $form['header']['bundle'] = array( + $form['header']['bundle'] = [ '#title' => $this->t('Bundle'), '#type' => 'select', '#options' => $bundle_options, '#default_value' => $current_bundle->getMachineName(), '#prefix' => '<div id="edit-package-set-wrapper">', '#suffix' => '</div>', - '#ajax' => array( + '#ajax' => [ 'callback' => '::updatePreview', 'wrapper' => 'edit-features-preview-wrapper', - ), - '#attributes' => array( + ], + '#attributes' => [ 'data-new-package-set' => 'status', - ), - ); + ], + ]; $form['preview'] = $this->buildListing($packages, $current_bundle); - $form['#attached'] = array( - 'library' => array( + $form['#attached'] = [ + 'library' => [ 'features_ui/drupal.features_ui.admin', - ), - ); + ], + ]; if (\Drupal::currentUser()->hasPermission('export configuration')) { // Offer available generation methods. @@ -183,24 +183,24 @@ public function buildForm(array $form, FormStateInterface $form_state) { // Sort generation methods by weight. uasort($generation_info, '\Drupal\Component\Utility\SortArray::sortByWeightElement'); - $form['description'] = array( + $form['description'] = [ '#markup' => '<p>' . $this->t('Use an export method button below to generate the selected features.') . '</p>', - ); + ]; - $form['actions'] = array('#type' => 'actions', '#tree' => TRUE); + $form['actions'] = ['#type' => 'actions', '#tree' => TRUE]; foreach ($generation_info as $method_id => $method) { - $form['actions'][$method_id] = array( + $form['actions'][$method_id] = [ '#type' => 'submit', '#name' => $method_id, - '#value' => $this->t('@name', array('@name' => $method['name'])), - '#attributes' => array( + '#value' => $this->t('@name', ['@name' => $method['name']]), + '#attributes' => [ 'title' => Html::escape($method['description']), - ), - ); + ], + ]; } } - $form['#pre_render'][] = array(get_class($this), 'preRenderRemoveInvalidCheckboxes'); + $form['#pre_render'][] = [get_class($this), 'preRenderRemoveInvalidCheckboxes']; return $form; } @@ -230,16 +230,16 @@ public function updatePreview($form, FormStateInterface $form_state) { */ protected function buildListing(array $packages, FeaturesBundleInterface $bundle) { - $header = array( - 'name' => array('data' => $this->t('Feature')), - 'machine_name' => array('data' => $this->t('')), - 'details' => array('data' => $this->t('Description'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), - 'version' => array('data' => $this->t('Version'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), - 'status' => array('data' => $this->t('Status'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), - 'state' => array('data' => $this->t('State'), 'class' => array(RESPONSIVE_PRIORITY_LOW)), - ); + $header = [ + 'name' => ['data' => $this->t('Feature')], + 'machine_name' => ['data' => $this->t('')], + 'details' => ['data' => $this->t('Description'), 'class' => [RESPONSIVE_PRIORITY_LOW]], + 'version' => ['data' => $this->t('Version'), 'class' => [RESPONSIVE_PRIORITY_LOW]], + 'status' => ['data' => $this->t('Status'), 'class' => [RESPONSIVE_PRIORITY_LOW]], + 'state' => ['data' => $this->t('State'), 'class' => [RESPONSIVE_PRIORITY_LOW]], + ]; - $options = array(); + $options = []; $first = TRUE; foreach ($packages as $package) { if ($first && $package->getStatus() == FeaturesManagerInterface::STATUS_NO_EXPORT) { @@ -250,25 +250,25 @@ protected function buildListing(array $packages, FeaturesBundleInterface $bundle continue; } $first = FALSE; - $options[] = array( - 'name' => array( + $options[] = [ + 'name' => [ 'data' => $this->t('The following packages are not exported.'), 'class' => 'features-export-header-row', 'colspan' => 6, - ), - ); + ], + ]; } $options[$package->getMachineName()] = $this->buildPackageDetail($package, $bundle); } - $element = array( + $element = [ '#type' => 'tableselect', '#header' => $header, '#options' => $options, - '#attributes' => array('class' => array('features-listing')), + '#attributes' => ['class' => ['features-listing']], '#prefix' => '<div id="edit-features-preview-wrapper">', '#suffix' => '</div>', - ); + ]; return $element; } @@ -287,12 +287,12 @@ protected function buildListing(array $packages, FeaturesBundleInterface $bundle protected function buildPackageDetail(Package $package, FeaturesBundleInterface $bundle) { $config_collection = $this->featuresManager->getConfigCollection(); - $url = Url::fromRoute('features.edit', array('featurename' => $package->getMachineName())); + $url = Url::fromRoute('features.edit', ['featurename' => $package->getMachineName()]); - $element['name'] = array( + $element['name'] = [ 'data' => \Drupal::l($package->getName(), $url), - 'class' => array('feature-name'), - ); + 'class' => ['feature-name'], + ]; $machine_name = $package->getMachineName(); // Except for the 'unpackaged' pseudo-package, display the full name, since // that's what will be generated. @@ -300,128 +300,128 @@ protected function buildPackageDetail(Package $package, FeaturesBundleInterface $machine_name = $bundle->getFullName($machine_name); } $element['machine_name'] = $machine_name; - $element['status'] = array( + $element['status'] = [ 'data' => $this->featuresManager->statusLabel($package->getStatus()), - 'class' => array('column-nowrap'), - ); + 'class' => ['column-nowrap'], + ]; // Use 'data' instead of plain string value so a blank version doesn't // remove column from table. - $element['version'] = array( + $element['version'] = [ 'data' => Html::escape($package->getVersion()), - 'class' => array('column-nowrap'), - ); + 'class' => ['column-nowrap'], + ]; $overrides = $this->featuresManager->detectOverrides($package); $new_config = $this->featuresManager->detectNew($package); - $conflicts = array(); - $missing = array(); - $moved = array(); + $conflicts = []; + $missing = []; + $moved = []; if ($package->getStatus() == FeaturesManagerInterface::STATUS_NO_EXPORT) { - $overrides = array(); - $new_config = array(); + $overrides = []; + $new_config = []; } // Bundle package configuration by type. - $package_config = array(); + $package_config = []; foreach ($package->getConfig() as $item_name) { if (isset($config_collection[$item_name])) { $item = $config_collection[$item_name]; - $package_config[$item->getType()][] = array( + $package_config[$item->getType()][] = [ 'name' => Html::escape($item_name), 'label' => Html::escape($item->getLabel()), 'class' => in_array($item_name, $overrides) ? 'features-override' : (in_array($item_name, $new_config) ? 'features-detected' : ''), - ); + ]; } } // Conflict config from other modules. foreach ($package->getConfigOrig() as $item_name) { if (!isset($config_collection[$item_name])) { $missing[] = $item_name; - $package_config['missing'][] = array( + $package_config['missing'][] = [ 'name' => Html::escape($item_name), 'label' => Html::escape($item_name), 'class' => 'features-missing', - ); + ]; } elseif (!in_array($item_name, $package->getConfig())) { $item = $config_collection[$item_name]; if (empty($item->getProvider())) { $conflicts[] = $item_name; $package_name = !empty($item->getPackage()) ? $item->getPackage() : $this->t('PACKAGE NOT ASSIGNED'); - $package_config[$item->getType()][] = array( + $package_config[$item->getType()][] = [ 'name' => Html::escape($package_name), 'label' => Html::escape($item->getLabel()), 'class' => 'features-conflict', - ); + ]; } else { $moved[] = $item_name; $package_name = !empty($item->getPackage()) ? $item->getPackage() : $this->t('PACKAGE NOT ASSIGNED'); - $package_config[$item->getType()][] = array( - 'name' => $this->t('Moved to @package', array('@package' => $package_name)), + $package_config[$item->getType()][] = [ + 'name' => $this->t('Moved to @package', ['@package' => $package_name]), 'label' => Html::escape($item->getLabel()), 'class' => 'features-moved', - ); + ]; } } } // Add dependencies. - $package_config['dependencies'] = array(); + $package_config['dependencies'] = []; foreach ($package->getDependencies() as $dependency) { - $package_config['dependencies'][] = array( + $package_config['dependencies'][] = [ 'name' => $dependency, - 'label' => $this->moduleHandler->getName($dependency), + 'label' => $this->moduleHandler->moduleExists($dependency) ? $this->moduleHandler->getName($dependency) : $dependency, 'class' => '', - ); + ]; } $class = ''; $state_links = []; if (!empty($conflicts)) { - $state_links[] = array( + $state_links[] = [ '#type' => 'link', '#title' => $this->t('Conflicts'), - '#url' => Url::fromRoute('features.edit', array('featurename' => $package->getMachineName())), - '#attributes' => array('class' => array('features-conflict')), - ); + '#url' => Url::fromRoute('features.edit', ['featurename' => $package->getMachineName()]), + '#attributes' => ['class' => ['features-conflict']], + ]; } if (!empty($overrides)) { - $state_links[] = array( + $state_links[] = [ '#type' => 'link', '#title' => $this->featuresManager->stateLabel(FeaturesManagerInterface::STATE_OVERRIDDEN), - '#url' => Url::fromRoute('features.diff', array('featurename' => $package->getMachineName())), - '#attributes' => array('class' => array('features-override')), - ); + '#url' => Url::fromRoute('features.diff', ['featurename' => $package->getMachineName()]), + '#attributes' => ['class' => ['features-override']], + ]; } if (!empty($new_config)) { - $state_links[] = array( + $state_links[] = [ '#type' => 'link', '#title' => $this->t('New detected'), - '#url' => Url::fromRoute('features.diff', array('featurename' => $package->getMachineName())), - '#attributes' => array('class' => array('features-detected')), - ); + '#url' => Url::fromRoute('features.diff', ['featurename' => $package->getMachineName()]), + '#attributes' => ['class' => ['features-detected']], + ]; } if (!empty($missing) && ($package->getStatus() == FeaturesManagerInterface::STATUS_INSTALLED)) { - $state_links[] = array( + $state_links[] = [ '#type' => 'link', '#title' => $this->t('Missing'), - '#url' => Url::fromRoute('features.edit', array('featurename' => $package->getMachineName())), - '#attributes' => array('class' => array('features-missing')), - ); + '#url' => Url::fromRoute('features.edit', ['featurename' => $package->getMachineName()]), + '#attributes' => ['class' => ['features-missing']], + ]; } if (!empty($moved)) { - $state_links[] = array( + $state_links[] = [ '#type' => 'link', '#title' => $this->t('Moved'), - '#url' => Url::fromRoute('features.edit', array('featurename' => $package->getMachineName())), - '#attributes' => array('class' => array('features-moved')), - ); + '#url' => Url::fromRoute('features.edit', ['featurename' => $package->getMachineName()]), + '#attributes' => ['class' => ['features-moved']], + ]; } if (!empty($state_links)) { - $element['state'] = array( + $element['state'] = [ 'data' => $state_links, - 'class' => array('column-nowrap'), - ); + 'class' => ['column-nowrap'], + ]; } else { $element['state'] = ''; @@ -473,7 +473,7 @@ protected function buildPackageDetail(Package $package, FeaturesBundleInterface ); $details['table'] = array( '#type' => 'details', - '#title' => array('#markup' => $this->t('Included configuration')), + '#title' => $this->t('Included configuration'), '#description' => array('data' => $element['table']), ); $element['details'] = array( diff --git a/web/modules/features/modules/features_ui/src/Tests/FeaturesUITest.php b/web/modules/features/modules/features_ui/src/Tests/FeaturesUITest.php index 51c4abb9c0..12f92ae5be 100644 --- a/web/modules/features/modules/features_ui/src/Tests/FeaturesUITest.php +++ b/web/modules/features/modules/features_ui/src/Tests/FeaturesUITest.php @@ -34,7 +34,7 @@ public function testFeaturesUI() { $this->assertText($this->t('You have not yet created any bundles. Before generating features, you may wish to create a bundle to group your features within.')); // Creating custom bundle. $this->drupalGet('admin/config/development/features/bundle'); - $this->drupalPostAjaxForm(NULL, array('bundle[bundle_select]' => 'new'), 'bundle[bundle_select]'); + $this->drupalPostAjaxForm(NULL, ['bundle[bundle_select]' => 'new'], 'bundle[bundle_select]'); $edit = [ 'bundle[name]' => 'foo', 'bundle[machine_name]' => 'foo', diff --git a/web/modules/features/src/Commands/FeaturesCommands.php b/web/modules/features/src/Commands/FeaturesCommands.php index 79807b6357..a0dec38e30 100644 --- a/web/modules/features/src/Commands/FeaturesCommands.php +++ b/web/modules/features/src/Commands/FeaturesCommands.php @@ -9,6 +9,7 @@ use Drupal\features\Exception\DomainException; use Drupal\features\Exception\InvalidArgumentException; use Drupal\features\FeaturesAssignerInterface; +use Drupal\features\FeaturesBundleInterface; use Drupal\features\FeaturesGeneratorInterface; use Drupal\features\FeaturesManagerInterface; use Drupal\features\Plugin\FeaturesGeneration\FeaturesGenerationWrite; @@ -246,7 +247,7 @@ public function status($keys = NULL, array $options = self::OPTIONS_STATUS) { public function listPackages($package_name = NULL, $options = self::OPTIONS_LIST) { $assigner = $this->featuresOptions($options); $current_bundle = $assigner->getBundle(); - $namespace = $current_bundle->isDefault() ? '' : $current_bundle->getMachineName(); + $namespace = $current_bundle->isDefault() ? FeaturesBundleInterface::DEFAULT_BUNDLE : $current_bundle->getMachineName(); $manager = $this->manager; $packages = $manager->getPackages(); @@ -312,7 +313,7 @@ public function listPackages($package_name = NULL, $options = self::OPTIONS_LIST public function importAll($options = self::OPTIONS_IMPORT_ALL) { $assigner = $this->featuresOptions($options); $currentBundle = $assigner->getBundle(); - $namespace = $currentBundle->isDefault() ? '' : $currentBundle->getMachineName(); + $namespace = $currentBundle->isDefault() ? FeaturesBundleInterface::DEFAULT_BUNDLE : $currentBundle->getMachineName(); $manager = $this->manager; $packages = $manager->getPackages(); diff --git a/web/modules/features/src/Controller/FeaturesController.php b/web/modules/features/src/Controller/FeaturesController.php index 701895aa2a..e456577e31 100644 --- a/web/modules/features/src/Controller/FeaturesController.php +++ b/web/modules/features/src/Controller/FeaturesController.php @@ -69,7 +69,7 @@ public function downloadExport($uri, Request $request) { throw new AccessDeniedHttpException(); } - $request = new Request(array('file' => $uri)); + $request = new Request(['file' => $uri]); return $this->fileDownloadController->download($request, 'temporary'); } } diff --git a/web/modules/features/src/Entity/FeaturesBundle.php b/web/modules/features/src/Entity/FeaturesBundle.php index 5901433105..ced0be6de6 100644 --- a/web/modules/features/src/Entity/FeaturesBundle.php +++ b/web/modules/features/src/Entity/FeaturesBundle.php @@ -193,7 +193,7 @@ public function setProfileName($machine_name) { * {@inheritdoc} */ public function getEnabledAssignments() { - $list = array(); + $list = []; foreach ($this->assignments as $method_id => $method) { if ($method['enabled']) { $list[$method_id] = $method_id; @@ -221,7 +221,7 @@ public function setEnabledAssignments(array $assignments) { * {@inheritdoc} */ public function getAssignmentWeights() { - $list = array(); + $list = []; foreach ($this->assignments as $method_id => $method) { $list[$method_id] = $method['weight']; } @@ -275,7 +275,7 @@ public function getAssignmentSettings($method_id = NULL) { } } else { - $list = array(); + $list = []; foreach (array_keys($this->assignments) as $method_id) { $list[$method_id] = $this->getAssignmentSettings($method_id); } diff --git a/web/modules/features/src/FeaturesAssigner.php b/web/modules/features/src/FeaturesAssigner.php index 75bf5a82d9..f06b0d1675 100644 --- a/web/modules/features/src/FeaturesAssigner.php +++ b/web/modules/features/src/FeaturesAssigner.php @@ -113,7 +113,7 @@ public function initFeaturesManager() { * {@inheritdoc} */ public function reset() { - $this->methods = array(); + $this->methods = []; $this->featuresManager->reset(); } @@ -181,7 +181,7 @@ public function getAssignmentMethods() { */ protected function getAssignmentMethodInstance($method_id) { if (!isset($this->methods[$method_id])) { - $instance = $this->assignerManager->createInstance($method_id, array()); + $instance = $this->assignerManager->createInstance($method_id, []); $instance->setFeaturesManager($this->featuresManager); $instance->setAssigner($this); $instance->setEntityTypeManager($this->entityTypeManager); @@ -261,7 +261,7 @@ public function setCurrent(FeaturesBundleInterface $bundle) { */ public function getBundleList() { if (empty($this->bundles)) { - $this->bundles = array(); + $this->bundles = []; foreach ($this->entityTypeManager->getStorage('features_bundle')->loadMultiple() as $machine_name => $bundle) { $this->bundles[$machine_name] = $bundle; } @@ -279,7 +279,7 @@ public function findBundleByName($name, $create = FALSE) { return $bundle; } } - $machine_name = strtolower(str_replace(array(' ', '-'), '_', $name)); + $machine_name = strtolower(str_replace([' ', '-'], '_', $name)); if (isset($bundles[$machine_name])) { return $bundles[$machine_name]; } @@ -311,7 +311,7 @@ public function createBundleFromDefault($machine_name, $name = NULL, $descriptio $bundle->setDescription($description); } else { - $bundle->setDescription(t('Auto-generated bundle from package @name', array('@name' => $name))); + $bundle->setDescription(t('Auto-generated bundle from package @name', ['@name' => $name])); } $bundle->setIsProfile($is_profile); if (isset($profile_name)) { @@ -374,7 +374,7 @@ public function createBundlesFromPackages() { */ public function getBundleOptions() { $list = $this->getBundleList(); - $result = array(); + $result = []; foreach ($list as $machine_name => $bundle) { $result[$machine_name] = $bundle->getName(); } diff --git a/web/modules/features/src/FeaturesConfigDependencyManager.php b/web/modules/features/src/FeaturesConfigDependencyManager.php index cca3507a18..ea01e305cd 100644 --- a/web/modules/features/src/FeaturesConfigDependencyManager.php +++ b/web/modules/features/src/FeaturesConfigDependencyManager.php @@ -17,9 +17,9 @@ class FeaturesConfigDependencyManager extends ConfigDependencyManager{ * {@inheritdoc} */ public function getDependentEntities($type, $name) { - $dependent_entities = array(); + $dependent_entities = []; - $entities_to_check = array(); + $entities_to_check = []; if ($type == 'config') { $entities_to_check[] = $name; } @@ -42,7 +42,7 @@ public function getDependentEntities($type, $name) { // always after field storages. This is because field storages need to be // created before a field. $this->sorted_graph = $this->getGraph(); - uasort($this->sorted_graph, array($this, 'sortGraph')); + uasort($this->sorted_graph, [$this, 'sortGraph']); } return array_replace(array_intersect_key($this->sorted_graph, $dependencies), $dependencies); } diff --git a/web/modules/features/src/FeaturesConfigInstaller.php b/web/modules/features/src/FeaturesConfigInstaller.php index 2d7edd0e69..da4c2a9417 100644 --- a/web/modules/features/src/FeaturesConfigInstaller.php +++ b/web/modules/features/src/FeaturesConfigInstaller.php @@ -75,7 +75,7 @@ protected function findPreExistingConfiguration(StorageInterface $storage) { $features_config = array_keys($this->featuresManager->listExistingConfig()); // Map array so we can use isset instead of in_array for faster access. $features_config = array_combine($features_config, $features_config); - $existing_configuration = array(); + $existing_configuration = []; // Gather information about all the supported collections. $collection_info = $this->configManager->getConfigCollectionInfo(); diff --git a/web/modules/features/src/FeaturesExtensionStoragesByDirectory.php b/web/modules/features/src/FeaturesExtensionStoragesByDirectory.php new file mode 100644 index 0000000000..6c0269e9e1 --- /dev/null +++ b/web/modules/features/src/FeaturesExtensionStoragesByDirectory.php @@ -0,0 +1,24 @@ +<?php + +namespace Drupal\features; + +/** + * Wraps FeaturesInstallStorage to support multiple configuration + * directories. + */ +class FeaturesExtensionStoragesByDirectory extends FeaturesExtensionStorages implements FeaturesExtensionStoragesByDirectoryInterface { + + /** + * {@inheritdoc} + */ + public function listAllByDirectory($prefix = '') { + if (!isset($this->configurationLists[$prefix])) { + $this->configurationLists[$prefix] = []; + foreach ($this->extensionStorages as $directory => $extension_storage) { + $this->configurationLists[$prefix] += array_fill_keys($extension_storage->listAll($prefix), $directory); + } + } + return $this->configurationLists[$prefix]; + } + +} diff --git a/web/modules/features/src/FeaturesExtensionStoragesByDirectoryInterface.php b/web/modules/features/src/FeaturesExtensionStoragesByDirectoryInterface.php new file mode 100644 index 0000000000..e955cecce3 --- /dev/null +++ b/web/modules/features/src/FeaturesExtensionStoragesByDirectoryInterface.php @@ -0,0 +1,26 @@ +<?php + +namespace Drupal\features; + +/** + * Defines an extended interface for extension storages. + */ +interface FeaturesExtensionStoragesByDirectoryInterface extends FeaturesExtensionStoragesInterface { + + /** + * Returns a list of all configuration available from extensions. + * + * This method was made public late in the 8.x-3.x cycle and so is not + * included in the interface. + * + * @param string $prefix + * (optional) The prefix to search for. If omitted, all configuration object + * names that exist are returned. + * + * @return array + * An array with configuration item names as keys and configuration + * directories as values. + */ + public function listAllByDirectory($prefix = ''); + +} diff --git a/web/modules/features/src/FeaturesGenerationMethodBase.php b/web/modules/features/src/FeaturesGenerationMethodBase.php index 485fa09fe6..e329f68639 100644 --- a/web/modules/features/src/FeaturesGenerationMethodBase.php +++ b/web/modules/features/src/FeaturesGenerationMethodBase.php @@ -65,7 +65,7 @@ protected function mergeInfoFile($package_info, $info_file_uri) { /** * {@inheritdoc} */ - public function prepare(array &$packages = array(), FeaturesBundleInterface $bundle = NULL) { + public function prepare(array &$packages = [], FeaturesBundleInterface $bundle = NULL) { // If no packages were specified, get all packages. if (empty($packages)) { $packages = $this->featuresManager->getPackages(); diff --git a/web/modules/features/src/FeaturesGenerationMethodInterface.php b/web/modules/features/src/FeaturesGenerationMethodInterface.php index b3191f2026..92b9392804 100644 --- a/web/modules/features/src/FeaturesGenerationMethodInterface.php +++ b/web/modules/features/src/FeaturesGenerationMethodInterface.php @@ -37,7 +37,7 @@ public function setAssigner(FeaturesAssignerInterface $assigner); * @return array * An array of packages data. */ - public function prepare(array &$packages = array(), FeaturesBundleInterface $bundle = NULL); + public function prepare(array &$packages = [], FeaturesBundleInterface $bundle = NULL); /** * Performs package generation. @@ -56,7 +56,7 @@ public function prepare(array &$packages = array(), FeaturesBundleInterface $bun * - 'message': a message about the result of the operation. * - 'variables': an array of substitutions to be used in the message. */ - public function generate(array $packages = array(), FeaturesBundleInterface $bundle = NULL); + public function generate(array $packages = [], FeaturesBundleInterface $bundle = NULL); /** * Responds to the submission of diff --git a/web/modules/features/src/FeaturesGenerator.php b/web/modules/features/src/FeaturesGenerator.php index ce461cbf23..ae21e60b7a 100644 --- a/web/modules/features/src/FeaturesGenerator.php +++ b/web/modules/features/src/FeaturesGenerator.php @@ -69,13 +69,13 @@ public function initFeaturesManager() { * {@inheritdoc} */ public function reset() { - $this->methods = array(); + $this->methods = []; } /** * {@inheritdoc} */ - public function applyGenerationMethod($method_id, array $packages = array(), FeaturesBundleInterface $bundle = NULL) { + public function applyGenerationMethod($method_id, array $packages = [], FeaturesBundleInterface $bundle = NULL) { $method = $this->getGenerationMethodInstance($method_id); $method->prepare($packages, $bundle); return $method->generate($packages, $bundle); @@ -107,7 +107,7 @@ public function getGenerationMethods() { */ protected function getGenerationMethodInstance($method_id) { if (!isset($this->methods[$method_id])) { - $instance = $this->generatorManager->createInstance($method_id, array()); + $instance = $this->generatorManager->createInstance($method_id, []); $instance->setFeaturesManager($this->featuresManager); $instance->setAssigner($this->assigner); $this->methods[$method_id] = $instance; @@ -118,7 +118,7 @@ protected function getGenerationMethodInstance($method_id) { /** * {@inheritdoc} */ - public function generatePackages($method_id, FeaturesBundleInterface $bundle, array $package_names = array()) { + public function generatePackages($method_id, FeaturesBundleInterface $bundle, array $package_names = []) { $this->featuresManager->setPackageBundleNames($bundle, $package_names); return $this->generate($method_id, $bundle, $package_names); } @@ -144,7 +144,7 @@ public function generatePackages($method_id, FeaturesBundleInterface $bundle, ar * - 'message': a message about the result of the operation. * - 'variables': an array of substitutions to be used in the message. */ - protected function generate($method_id, FeaturesBundleInterface $bundle, array $package_names = array()) { + protected function generate($method_id, FeaturesBundleInterface $bundle, array $package_names = []) { $packages = $this->featuresManager->getPackages(); // Filter out the packages that weren't requested. diff --git a/web/modules/features/src/FeaturesGeneratorInterface.php b/web/modules/features/src/FeaturesGeneratorInterface.php index 485e71beaf..0cafa14514 100644 --- a/web/modules/features/src/FeaturesGeneratorInterface.php +++ b/web/modules/features/src/FeaturesGeneratorInterface.php @@ -71,7 +71,7 @@ public function reset(); * - 'message': a message about the result of the operation. * - 'variables': an array of substitutions to be used in the message. */ - public function applyGenerationMethod($method_id, array $packages = array(), FeaturesBundleInterface $bundle = NULL); + public function applyGenerationMethod($method_id, array $packages = [], FeaturesBundleInterface $bundle = NULL); /** * Responds to the submission of @@ -98,6 +98,6 @@ public function getGenerationMethods(); * Array of names of packages to be generated. If none are specified, all * available packages will be added. */ - public function generatePackages($method_id, FeaturesBundleInterface $bundle, array $package_names = array()); + public function generatePackages($method_id, FeaturesBundleInterface $bundle, array $package_names = []); } diff --git a/web/modules/features/src/FeaturesInstallStorage.php b/web/modules/features/src/FeaturesInstallStorage.php index 3742ea17bc..666b5d6803 100644 --- a/web/modules/features/src/FeaturesInstallStorage.php +++ b/web/modules/features/src/FeaturesInstallStorage.php @@ -66,7 +66,7 @@ public function __construct(StorageInterface $config_storage, $directory = self: */ public function getAllFolders() { if (!isset($this->folders)) { - $this->folders = array(); + $this->folders = []; $this->folders += $this->getCoreNames(); $install_profile = Settings::get('install_profile'); @@ -117,8 +117,8 @@ public function getAllFolders() { // CHANGED START: Put Features modules first in list returned. // to allow features to override config provided by other extensions. $featuresManager = \Drupal::service('features.manager'); - $features_list = array(); - $module_list = array(); + $features_list = []; + $module_list = []; foreach (array_keys($module_list_scan) as $module) { if ($featuresManager->isFeatureModule($module_list_scan[$module])) { $features_list[$module] = $module_list_scan[$module]; @@ -150,7 +150,7 @@ public function getAllFolders() { $profile_list = $listing->scan('profile'); } if (isset($profile_list[$profile])) { - $profile_folders = $this->getComponentNames(array($profile_list[$profile])); + $profile_folders = $this->getComponentNames([$profile_list[$profile]]); $this->folders = $profile_folders + $this->folders; } } diff --git a/web/modules/features/src/FeaturesManager.php b/web/modules/features/src/FeaturesManager.php index cf93297070..07c46e0427 100644 --- a/web/modules/features/src/FeaturesManager.php +++ b/web/modules/features/src/FeaturesManager.php @@ -39,7 +39,7 @@ class FeaturesManager implements FeaturesManagerInterface { /** * The extension storages. * - * @var \Drupal\features\FeaturesExtensionStoragesInterface + * @var \Drupal\features\FeaturesExtensionStoragesByDirectoryInterface */ protected $extensionStorages; @@ -148,7 +148,7 @@ public function __construct($root, EntityTypeManagerInterface $entity_type_manag $this->configFactory = $config_factory; $this->configReverter = $config_reverter; $this->settings = $config_factory->getEditable('features.settings'); - $this->extensionStorages = new FeaturesExtensionStorages($this->configStorage); + $this->extensionStorages = new FeaturesExtensionStoragesByDirectory($this->configStorage); $this->extensionStorages->addStorage(InstallStorage::CONFIG_INSTALL_DIRECTORY); $this->extensionStorages->addStorage(InstallStorage::CONFIG_OPTIONAL_DIRECTORY); $this->packages = []; @@ -196,10 +196,10 @@ public function getFullName($type, $name) { * {@inheritdoc} */ public function getConfigType($fullname) { - $result = array( + $result = [ 'type' => '', 'name_short' => '', - ); + ]; $prefix = FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG . '.'; if (strpos($fullname, $prefix) !== FALSE) { $result['type'] = FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG; @@ -320,7 +320,7 @@ public function loadPackage($module_name, $any = FALSE) { * {@inheritdoc} */ public function filterPackages(array $packages, $namespace = '', $only_exported = FALSE) { - $result = array(); + $result = []; /** @var \Drupal\features\Package $package */ foreach ($packages as $key => $package) { // A package matches the namespace if: @@ -417,7 +417,7 @@ public function isFeatureModule(Extension $module, FeaturesBundleInterface $bund /** * {@inheritdoc} */ - public function listPackageDirectories(array $machine_names = array(), FeaturesBundleInterface $bundle = NULL) { + public function listPackageDirectories(array $machine_names = [], FeaturesBundleInterface $bundle = NULL) { if (empty($machine_names)) { $machine_names = array_keys($this->getPackages()); } @@ -438,7 +438,7 @@ public function listPackageDirectories(array $machine_names = array(), FeaturesB return in_array($module->getName(), $machine_names); }); - $directories = array(); + $directories = []; foreach ($modules as $module) { $directories[$module->getName()] = $module->getPath(); } @@ -546,7 +546,7 @@ public function initPackageFromExtension(Extension $extension) { * @param array $module_list * @return array $dependencies */ - protected function getConfigDependency(ConfigurationItem $config, $module_list = array()) { + protected function getConfigDependency(ConfigurationItem $config, $module_list = []) { $dependencies = []; $type = $config->getType(); @@ -737,7 +737,7 @@ public function assignPackageDependencies(Package $package = NULL) { $packages = $this->getPackages(); } else { - $packages = array($package); + $packages = [$package]; } $module_list = $this->moduleHandler->getModuleList(); $config_collection = $this->getConfigCollection(); @@ -940,7 +940,7 @@ protected function addInfoFile(Package $package) { } if ($package->getConfig()) { - foreach (array('excluded', 'required') as $constraint) { + foreach (['excluded', 'required'] as $constraint) { if (!empty($package->{'get' . $constraint}())) { $features_info[$constraint] = $package->{'get' . $constraint}(); } @@ -957,7 +957,7 @@ protected function addInfoFile(Package $package) { // The name and description need to be cast as strings from the // TranslatableMarkup objects returned by t() to avoid raising an // InvalidDataTypeException on Yaml serialization. - foreach (array('name', 'description') as $key) { + foreach (['name', 'description'] as $key) { $info[$key] = (string) $info[$key]; } @@ -1008,7 +1008,7 @@ protected function addPackageFiles(Package $package) { /** * {@inheritdoc} */ - public function mergeInfoArray(array $info1, array $info2, array $keys = array()) { + public function mergeInfoArray(array $info1, array $info2, array $keys = []) { // If keys were specified, use only those. if (!empty($keys)) { $info2 = array_intersect_key($info2, array_fill_keys($keys, NULL)); @@ -1061,7 +1061,7 @@ public function listExtensionConfig(Extension $extension) { * {@inheritdoc} */ public function listExistingConfig($installed = FALSE, FeaturesBundleInterface $bundle = NULL) { - $config = array(); + $config = []; $existing = $this->getFeaturesModules($bundle, $installed); foreach ($existing as $extension) { // Keys are configuration item names and values are providing extension @@ -1150,6 +1150,7 @@ protected function initConfigCollection($reset = FALSE) { $dependency_manager = $this->getFeaturesConfigDependencyManager(); // List configuration provided by installed features. $existing_config = $this->listExistingConfig(NULL); + $existing_config_by_directory = $this->extensionStorages->listAllByDirectory(); foreach (array_keys($config_types) as $config_type) { $config = $this->listConfigByType($config_type); foreach ($config as $item_name => $label) { @@ -1162,7 +1163,7 @@ protected function initConfigCollection($reset = FALSE) { 'type' => $config_type, 'dependents' => array_keys($dependency_manager->getDependentEntities('config', $name)), // Default to the install directory. - 'subdirectory' => InstallStorage::CONFIG_INSTALL_DIRECTORY, + 'subdirectory' => isset($existing_config_by_directory[$name]) ? $existing_config_by_directory[$name] : InstallStorage::CONFIG_INSTALL_DIRECTORY, 'package' => '', 'providerExcluded' => NULL, 'provider' => isset($existing_config[$name]) ? $existing_config[$name] : NULL, @@ -1211,7 +1212,7 @@ public function getExportInfo(Package $package, FeaturesBundleInterface $bundle $path = dirname($extension_path); } - return array($full_name, $path); + return [$full_name, $path]; } /** @@ -1221,11 +1222,11 @@ public function detectOverrides(Package $feature, $include_new = FALSE) { /** @var \Drupal\config_update\ConfigDiffInterface $config_diff */ $config_diff = \Drupal::service('config_update.config_diff'); - $different = array(); + $different = []; foreach ($feature->getConfig() as $name) { $active = $this->configStorage->read($name); $extension = $this->extensionStorages->read($name); - $extension = !empty($extension) ? $extension : array(); + $extension = !empty($extension) ? $extension : []; if (($include_new || !empty($extension)) && !$config_diff->same($extension, $active)) { $different[] = $name; } @@ -1241,7 +1242,7 @@ public function detectOverrides(Package $feature, $include_new = FALSE) { * {@inheritdoc} */ public function detectNew(Package $feature) { - $result = array(); + $result = []; foreach ($feature->getConfig() as $name) { $extension = $this->extensionStorages->read($name); if (empty($extension)) { @@ -1256,7 +1257,7 @@ public function detectNew(Package $feature) { */ public function detectMissing(Package $feature) { $config = $this->getConfigCollection(); - $result = array(); + $result = []; foreach ($feature->getConfigOrig() as $name) { if (!isset($config[$name])) { $result[] = $name; @@ -1269,8 +1270,8 @@ public function detectMissing(Package $feature) { * {@inheritdoc} */ public function reorderMissing(array $missing) { - $list = array(); - $result = array(); + $list = []; + $result = []; foreach ($missing as $full_name) { $this->addConfigList($full_name, $list); } diff --git a/web/modules/features/src/FeaturesManagerInterface.php b/web/modules/features/src/FeaturesManagerInterface.php index 6416a647a1..2f47e5248b 100644 --- a/web/modules/features/src/FeaturesManagerInterface.php +++ b/web/modules/features/src/FeaturesManagerInterface.php @@ -328,7 +328,7 @@ public function initPackageFromExtension(Extension $extension); * @return array * Array of package directories keyed by package machine name. */ - public function listPackageDirectories(array $machine_names = array(), FeaturesBundleInterface $bundle = NULL); + public function listPackageDirectories(array $machine_names = [], FeaturesBundleInterface $bundle = NULL); /** * Assigns a set of configuration items to a given package or profile. @@ -414,7 +414,7 @@ public function assignInterPackageDependencies(FeaturesBundleInterface $bundle, * * @fixme Should this be moved to the package object or a related helper? */ - public function mergeInfoArray(array $info1, array $info2, array $keys = array()); + public function mergeInfoArray(array $info1, array $info2, array $keys = []); /** * Lists the types of configuration available on the site. diff --git a/web/modules/features/src/Package.php b/web/modules/features/src/Package.php index 2fb459a1d6..c7f2872a29 100644 --- a/web/modules/features/src/Package.php +++ b/web/modules/features/src/Package.php @@ -429,7 +429,7 @@ public function setFeaturesInfo($features_info) { $this->setBundle($features_info['bundle']); } $this->setRequired(isset($features_info['required']) ? $features_info['required'] : false); - $this->setExcluded(isset($features_info['excluded']) ? $features_info['excluded'] : array()); + $this->setExcluded(isset($features_info['excluded']) ? $features_info['excluded'] : []); return $this; } diff --git a/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php b/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php index 40fcbca85a..a8f83cb640 100644 --- a/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php +++ b/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentBaseType.php @@ -2,7 +2,7 @@ namespace Drupal\features\Plugin\FeaturesAssignment; -use Drupal\component\Utility\Unicode; +use Drupal\Component\Utility\Unicode; use Drupal\features\FeaturesAssignmentMethodBase; /** @@ -37,7 +37,7 @@ public function assignPackages($force = FALSE) { foreach ($config_collection as $item_name => $item) { if (in_array($item->getType(), $config_base_types)) { if (is_null($this->featuresManager->findPackage($item->getShortName())) && !$item->getPackage()) { - $description = $this->t('Provides @label @type and related configuration.', array('@label' => $item->getLabel(), '@type' => Unicode::strtolower($config_types[$item->getType()]))); + $description = $this->t('Provides @label @type and related configuration.', ['@label' => $item->getLabel(), '@type' => Unicode::strtolower($config_types[$item->getType()])]); if (isset($item->getData()['description'])) { $description .= ' ' . $item->getData()['description']; } @@ -59,7 +59,7 @@ public function assignPackages($force = FALSE) { foreach ($content_base_types as $entity_type_id) { if (!isset($packages[$entity_type_id]) && isset($entity_types[$entity_type_id])) { $label = $entity_types[$entity_type_id]->getLabel(); - $description = $this->t('Provide @label related configuration.', array('@label' => $label)); + $description = $this->t('Provide @label related configuration.', ['@label' => $label]); $this->featuresManager->initPackage($entity_type_id, $label, $description, 'module', $current_bundle); } } diff --git a/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentProfile.php b/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentProfile.php index 0783d4d548..81c503e073 100644 --- a/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentProfile.php +++ b/web/modules/features/src/Plugin/FeaturesAssignment/FeaturesAssignmentProfile.php @@ -71,7 +71,7 @@ public function assignPackages($force = FALSE) { // Only read in from the Standard profile if this profile doesn't already // exist. - $package_directories = $this->featuresManager->listPackageDirectories(array(), $current_bundle); + $package_directories = $this->featuresManager->listPackageDirectories([], $current_bundle); if (!isset($package_directories[$profile_name])) { $standard_directory = 'core/profiles/standard'; // Conditionally add files from the 'standard' install profile. diff --git a/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php b/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php index 2565685b55..a40c7a6dcf 100644 --- a/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php +++ b/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php @@ -128,7 +128,7 @@ protected function preparePackage(Package $package, array $existing_packages, Fe /** * {@inheritdoc} */ - public function generate(array $packages = array(), FeaturesBundleInterface $bundle = NULL) { + public function generate(array $packages = [], FeaturesBundleInterface $bundle = NULL) { // If no packages were specified, get all packages. if (empty($packages)) { diff --git a/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php b/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php index 118108c7d0..5844c0e2d1 100644 --- a/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php +++ b/web/modules/features/src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php @@ -101,7 +101,7 @@ protected function preparePackage(Package $package, array $existing_packages, Fe /** * {@inheritdoc} */ - public function generate(array $packages = array(), FeaturesBundleInterface $bundle = NULL) { + public function generate(array $packages = [], FeaturesBundleInterface $bundle = NULL) { // If no packages were specified, get all packages. if (empty($packages)) { $packages = $this->featuresManager->getPackages(); diff --git a/web/modules/features/tests/modules/test_feature/test_feature.info.yml b/web/modules/features/tests/modules/test_feature/test_feature.info.yml index 4f9d07045b..b90578e884 100644 --- a/web/modules/features/tests/modules/test_feature/test_feature.info.yml +++ b/web/modules/features/tests/modules/test_feature/test_feature.info.yml @@ -6,8 +6,8 @@ package: Test dependencies: - features -# Information added by Drupal.org packaging script on 2018-02-27 -version: '8.x-3.7' +# Information added by Drupal.org packaging script on 2018-09-09 +version: '8.x-3.8' core: '8.x' project: 'features' -datestamp: 1519763291 +datestamp: 1536512288 diff --git a/web/modules/features/tests/modules/test_mybundle_core/test_mybundle_core.info.yml b/web/modules/features/tests/modules/test_mybundle_core/test_mybundle_core.info.yml index f3c0339335..2f0e6404ab 100644 --- a/web/modules/features/tests/modules/test_mybundle_core/test_mybundle_core.info.yml +++ b/web/modules/features/tests/modules/test_mybundle_core/test_mybundle_core.info.yml @@ -6,8 +6,8 @@ package: Test dependencies: - features -# Information added by Drupal.org packaging script on 2018-02-27 -version: '8.x-3.7' +# Information added by Drupal.org packaging script on 2018-09-09 +version: '8.x-3.8' core: '8.x' project: 'features' -datestamp: 1519763291 +datestamp: 1536512288 diff --git a/web/modules/features/tests/src/Kernel/FeaturesAssignerTest.php b/web/modules/features/tests/src/Kernel/FeaturesAssignerTest.php index 6bf9f03713..0477ece057 100644 --- a/web/modules/features/tests/src/Kernel/FeaturesAssignerTest.php +++ b/web/modules/features/tests/src/Kernel/FeaturesAssignerTest.php @@ -18,6 +18,15 @@ class FeaturesAssignerTest extends KernelTestBase { protected $strictConfigSchema = FALSE; + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + // We need system.site in order to run $this->configImporter->import(). + $this->installConfig('system'); + } + /** * Test bundle auto-creation during config import. * @@ -41,7 +50,7 @@ public function testBundleAutoCreationImport() { // Uninstall modules. $installer->uninstall(['features', 'test_feature']); - // Restore the config from after install.. + // Restore the config from after install. $this->configImporter()->import(); // Find the auto-created bundle. -- GitLab