From cf0c04195b8bd267700dea83f41e7f6fd0a3ce81 Mon Sep 17 00:00:00 2001 From: Brian Weaver <weaver.299@osu.edu> Date: Mon, 26 Apr 2021 15:06:00 -0400 Subject: [PATCH] Remove unused module webform_views --- composer.json | 1 - composer.lock | 63 +--- vendor/composer/InstalledVersions.php | 13 +- vendor/composer/installed.json | 59 --- vendor/composer/installed.php | 13 +- web/modules/webform_views/LICENSE.txt | 339 ------------------ .../src/Plugin/Derivative/ViewsLocalTask.php | 129 ------- .../WebformSubmissionCastToNumberTrait.php | 23 -- .../Plugin/views/WebformSubmissionTrait.php | 37 -- .../views/field/WebformSubmissionField.php | 140 -------- .../field/WebformSubmissionFieldNumeric.php | 28 -- .../WebformSubmissionCheckboxFilter.php | 13 - .../filter/WebformSubmissionFieldFilter.php | 265 -------------- .../filter/WebformSubmissionNumericFilter.php | 172 --------- .../filter/WebformSubmissionSelectFilter.php | 97 ----- .../WebformSubmissionFieldNumericSort.php | 27 -- .../views/sort/WebformSubmissionFieldSort.php | 14 - .../src/Routing/RouteSubscriber.php | 57 --- .../WebformCheckboxViews.php | 26 -- .../WebformElementViews/WebformDateViews.php | 27 -- .../WebformDefaultViews.php | 41 --- .../WebformElementViewsAbstract.php | 110 ------ .../WebformElementViewsInterface.php | 46 --- .../WebformManagedFileViews.php | 9 - .../WebformNumericViews.php | 30 -- .../WebformSelectViews.php | 26 -- .../src/WebformSubmissionViewsData.php | 140 -------- .../webform_views/webform_views.api.php | 29 -- .../webform_views/webform_views.info.yml | 14 - .../webform_views.links.task.yml | 3 - .../webform_views/webform_views.module | 185 ---------- .../webform_views/webform_views.services.yml | 6 - 32 files changed, 5 insertions(+), 2177 deletions(-) delete mode 100644 web/modules/webform_views/LICENSE.txt delete mode 100644 web/modules/webform_views/src/Plugin/Derivative/ViewsLocalTask.php delete mode 100644 web/modules/webform_views/src/Plugin/views/WebformSubmissionCastToNumberTrait.php delete mode 100644 web/modules/webform_views/src/Plugin/views/WebformSubmissionTrait.php delete mode 100644 web/modules/webform_views/src/Plugin/views/field/WebformSubmissionField.php delete mode 100644 web/modules/webform_views/src/Plugin/views/field/WebformSubmissionFieldNumeric.php delete mode 100644 web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionCheckboxFilter.php delete mode 100644 web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionFieldFilter.php delete mode 100644 web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php delete mode 100644 web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionSelectFilter.php delete mode 100644 web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldNumericSort.php delete mode 100644 web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldSort.php delete mode 100644 web/modules/webform_views/src/Routing/RouteSubscriber.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformCheckboxViews.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformDateViews.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformDefaultViews.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformElementViewsAbstract.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformElementViewsInterface.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformManagedFileViews.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformNumericViews.php delete mode 100644 web/modules/webform_views/src/WebformElementViews/WebformSelectViews.php delete mode 100644 web/modules/webform_views/src/WebformSubmissionViewsData.php delete mode 100644 web/modules/webform_views/webform_views.api.php delete mode 100644 web/modules/webform_views/webform_views.info.yml delete mode 100644 web/modules/webform_views/webform_views.links.task.yml delete mode 100644 web/modules/webform_views/webform_views.module delete mode 100644 web/modules/webform_views/webform_views.services.yml diff --git a/composer.json b/composer.json index 3400dcd26a..4127d457ca 100644 --- a/composer.json +++ b/composer.json @@ -182,7 +182,6 @@ "drupal/views_infinite_scroll": "1.8", "drupal/views_slideshow": "4.4", "drupal/webform": "5.25", - "drupal/webform_views": "5.0-alpha2", "drush-ops/behat-drush-endpoint": "0.0.5", "drush/drush": "9.7.2", "enyo/dropzone": "^5", diff --git a/composer.lock b/composer.lock index db65cdda4f..ab683a0a64 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1734bae5bd7f4f1f7f709a0eec995df9", + "content-hash": "bd4fa4cecf7713e186cb6760a5bc5ffb", "packages": [ { "name": "alchemy/zippy", @@ -8700,67 +8700,6 @@ "forum": "https://drupal.stackexchange.com/questions/tagged/webform" } }, - { - "name": "drupal/webform_views", - "version": "5.0.0-alpha2", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/webform_views.git", - "reference": "8.x-5.0-alpha2" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/webform_views-8.x-5.0-alpha2.zip", - "reference": "8.x-5.0-alpha2", - "shasum": "288e0efa09423e3c3368d6aff9002ca41292238c" - }, - "require": { - "drupal/core": "^8", - "drupal/webform": "*" - }, - "type": "drupal-module", - "extra": { - "drupal": { - "version": "8.x-5.0-alpha2", - "datestamp": "1512044585", - "security-coverage": { - "status": "not-covered", - "message": "Alpha releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "acbramley", - "homepage": "https://www.drupal.org/user/1036766" - }, - { - "name": "bucefal91", - "homepage": "https://www.drupal.org/user/504128" - }, - { - "name": "jrockowitz", - "homepage": "https://www.drupal.org/user/371407" - }, - { - "name": "matio89", - "homepage": "https://www.drupal.org/user/2320090" - }, - { - "name": "ws.agency", - "homepage": "https://www.drupal.org/user/2851415" - } - ], - "description": "Webform integration with views.", - "homepage": "https://www.drupal.org/project/webform_views", - "support": { - "source": "https://git.drupalcode.org/project/webform_views" - } - }, { "name": "drush-ops/behat-drush-endpoint", "version": "0.0.5", diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 67509ae0e8..5121d9784a 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -30,7 +30,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => 'a1a8675385178b4d158de7171409e7877dcae11b', + 'reference' => 'ad47c9f055c9ad55f2573309b7bf573637283092', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -2070,15 +2070,6 @@ class InstalledVersions ), 'reference' => '8.x-5.25', ), - 'drupal/webform_views' => - array ( - 'pretty_version' => '5.0.0-alpha2', - 'version' => '5.0.0.0-alpha2', - 'aliases' => - array ( - ), - 'reference' => '8.x-5.0-alpha2', - ), 'drupal/workflows' => array ( 'replaced' => @@ -2350,7 +2341,7 @@ class InstalledVersions 'aliases' => array ( ), - 'reference' => 'a1a8675385178b4d158de7171409e7877dcae11b', + 'reference' => 'ad47c9f055c9ad55f2573309b7bf573637283092', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 2ad1ded874..300a88a957 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -9047,65 +9047,6 @@ }, "install-path": "../../web/modules/webform" }, - { - "name": "drupal/webform_views", - "version": "5.0.0-alpha2", - "version_normalized": "5.0.0.0-alpha2", - "source": { - "type": "git", - "url": "https://git.drupalcode.org/project/webform_views.git", - "reference": "8.x-5.0-alpha2" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/webform_views-8.x-5.0-alpha2.zip", - "reference": "8.x-5.0-alpha2", - "shasum": "288e0efa09423e3c3368d6aff9002ca41292238c" - }, - "require": { - "drupal/core": "*", - "drupal/webform": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-5.x": "5.x-dev" - }, - "drupal": { - "version": "8.x-5.0-alpha2", - "datestamp": "1512044585", - "security-coverage": { - "status": "not-covered", - "message": "Alpha releases are not covered by Drupal security advisories." - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "bucefal91", - "homepage": "https://www.drupal.org/user/504128" - }, - { - "name": "jrockowitz", - "homepage": "https://www.drupal.org/user/371407" - }, - { - "name": "ws.agency", - "homepage": "https://www.drupal.org/user/2851415" - } - ], - "description": "Webform integration with views.", - "homepage": "https://www.drupal.org/project/webform_views", - "support": { - "source": "http://cgit.drupalcode.org/webform_views" - }, - "install-path": "../../web/modules/webform_views" - }, { "name": "drush-ops/behat-drush-endpoint", "version": "0.0.5", diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index f319476939..e04c88233c 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => 'a1a8675385178b4d158de7171409e7877dcae11b', + 'reference' => 'ad47c9f055c9ad55f2573309b7bf573637283092', 'name' => 'osu-asc-webservices/d8-upstream', ), 'versions' => @@ -2046,15 +2046,6 @@ ), 'reference' => '8.x-5.25', ), - 'drupal/webform_views' => - array ( - 'pretty_version' => '5.0.0-alpha2', - 'version' => '5.0.0.0-alpha2', - 'aliases' => - array ( - ), - 'reference' => '8.x-5.0-alpha2', - ), 'drupal/workflows' => array ( 'replaced' => @@ -2326,7 +2317,7 @@ 'aliases' => array ( ), - 'reference' => 'a1a8675385178b4d158de7171409e7877dcae11b', + 'reference' => 'ad47c9f055c9ad55f2573309b7bf573637283092', ), 'pantheon-systems/quicksilver-pushback' => array ( diff --git a/web/modules/webform_views/LICENSE.txt b/web/modules/webform_views/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/webform_views/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/web/modules/webform_views/src/Plugin/Derivative/ViewsLocalTask.php b/web/modules/webform_views/src/Plugin/Derivative/ViewsLocalTask.php deleted file mode 100644 index 237e0e4c65..0000000000 --- a/web/modules/webform_views/src/Plugin/Derivative/ViewsLocalTask.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\Derivative; - -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\State\StateInterface; -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\Core\Routing\RouteProviderInterface; -use Drupal\views\Views; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides local task definitions webform submission views. - * - * With this derivative it's possible to set up views on paths like: - * - /webform/webform-id/my-submission-view - * - /webform/webform-another-id/my-submission-view - * - * Therefore you can have 2 different views for 2 different webforms on the same - * route. Standard views local task derivative would allow you to set up only - * one view on the path /webform/%webform/my-submission-view. - */ -class ViewsLocalTask extends DeriverBase implements ContainerDeriverInterface { - - /** - * The route provider. - * - * @var \Drupal\Core\Routing\RouteProviderInterface - */ - protected $routeProvider; - - /** - * The state key value store. - * - * @var \Drupal\Core\State\StateInterface - */ - protected $state; - - /** - * The view storage. - * - * @var \Drupal\Core\Entity\EntityStorageInterface - */ - protected $viewStorage; - - /** - * Constructs a \Drupal\views\Plugin\Derivative\ViewsLocalTask instance. - * - * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider - * The route provider. - * @param \Drupal\Core\State\StateInterface $state - * The state key value store. - * @param \Drupal\Core\Entity\EntityStorageInterface $view_storage - * The view storage. - */ - public function __construct(RouteProviderInterface $route_provider, StateInterface $state, EntityStorageInterface $view_storage) { - $this->routeProvider = $route_provider; - $this->state = $state; - $this->viewStorage = $view_storage; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $container->get('router.route_provider'), - $container->get('state'), - $container->get('entity.manager')->getStorage('view') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - $this->derivatives = []; - - $view_route_names = $this->state->get('views.view_route_names'); - foreach (webform_views_applicable_views() as $trio) { - list($view_id, $display_id, $path) = $trio; - - /** @var $executable \Drupal\views\ViewExecutable */ - $executable = $this->viewStorage->load($view_id)->getExecutable(); - - $executable->setDisplay($display_id); - $menu = $executable->display_handler->getOption('menu'); - - $plugin_id = 'view.' . $executable->storage->id() . '.' . $display_id; - $route_name = $view_route_names[$executable->storage->id() . '.' . $display_id]; - - $parent_path = explode('/', $path); - array_pop($parent_path); - $parent_path = implode('/', $parent_path); - $pattern = '/' . $parent_path; - - if ($routes = $this->routeProvider->getRoutesByPattern($pattern)) { - foreach ($routes->all() as $name => $route) { - $this->derivatives['webform_views:' . $plugin_id] = [ - 'route_name' => $route_name, - 'weight' => $menu['weight'], - 'title' => $menu['title'], - 'base_route' => $name, - ] + $base_plugin_definition; - // Skip after the first found route. - break; - } - } - } - return $this->derivatives; - } - - /** - * Alters the webform views local tasks. - */ - public function alterLocalTasks(&$local_tasks) { - // We want to unset all the "standard" tabs - those generated by - // Drupal\views\Plugin\Derivative\ViewsLocalTask since we manage menu tabs - // of webform submission views on our own. - foreach (webform_views_applicable_views() as $trio) { - list($view_id, $display_id, $path) = $trio; - - $plugin_id = 'view.' . $view_id . '.' . $display_id; - unset($local_tasks['views_view:' . $plugin_id]); - } - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/WebformSubmissionCastToNumberTrait.php b/web/modules/webform_views/src/Plugin/views/WebformSubmissionCastToNumberTrait.php deleted file mode 100644 index 1c06369d8e..0000000000 --- a/web/modules/webform_views/src/Plugin/views/WebformSubmissionCastToNumberTrait.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views; - -/** - * Trait to cast a SQL expression to numeric data type. - */ -trait WebformSubmissionCastToNumberTrait { - - /** - * Cast a given SQL snippet to data type expected by this handler. - * - * @param string $value - * SQL snippet that should be casted - * - * @return string - * SQL snippet that casts provided $value to necessary data type - */ - protected function castToDataType($value) { - return "($value + 0)"; - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/WebformSubmissionTrait.php b/web/modules/webform_views/src/Plugin/views/WebformSubmissionTrait.php deleted file mode 100644 index 9d790d9ed3..0000000000 --- a/web/modules/webform_views/src/Plugin/views/WebformSubmissionTrait.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views; - -use Drupal\Core\Entity\EntityTypeManagerInterface; - -/** - * Trait for webform submission views handlers. - */ -trait WebformSubmissionTrait { - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Retrieve webform element on which this handler is set up. - * - * @return array - * Webform element on which this handler is set up - */ - protected function getWebformElement() { - return $this->getWebform()->getElementInitialized($this->definition['webform_submission_field']); - } - - /** - * Retrieve webform on which this handler is set up. - * - * @return \Drupal\Core\Entity\EntityInterface - * Webform on which this handler is set up - */ - protected function getWebform() { - return $this->entityTypeManager->getStorage('webform')->load($this->definition['webform_id']); - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionField.php b/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionField.php deleted file mode 100644 index 1c7a92624f..0000000000 --- a/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionField.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\field; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\field\FieldPluginBase; -use Drupal\views\ResultRow; -use Drupal\webform\Plugin\WebformElementManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Webform submission field. - * - * @ViewsField("webform_submission_field") - */ -class WebformSubmissionField extends FieldPluginBase { - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * @var WebformElementManagerInterface - */ - protected $webformElementManager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('plugin.manager.webform.element') - ); - } - - /** - * WebformSubmissionField constructor. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, WebformElementManagerInterface $webform_element_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->entityTypeManager = $entity_type_manager; - $this->webformElementManager = $webform_element_manager; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - - $options['webform_element_format'] = ['default' => '']; - - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - - $form['webform_element_format'] = [ - '#type' => 'select', - '#title' => $this->t('Format'), - '#description' => $this->t('Specify how to format this value.'), - '#options' => $this->getWebformElementPlugin()->getItemFormats(), - '#default_value' => $this->options['webform_element_format'] ?: $this->getWebformElementPlugin()->getItemDefaultFormat(), - ]; - - $form['webform_element_format']['#access'] = !empty($form['webform_element_format']['#options']); - } - - /** - * {@inheritdoc} - */ - public function render(ResultRow $values) { - if ($values->_entity->access('view')) { - $view_builder = $this->entityTypeManager->getViewBuilder('webform_submission'); - - /** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */ - $webform_submission = $values->_entity; - $webform = $webform_submission->getWebform(); - $elements = $webform->getElementsInitialized(); - if (!isset($elements[$this->definition['webform_submission_field']])) { - $elements = $webform->getElementsInitializedAndFlattened(); - } - - $excluded_elements = $elements; - unset($excluded_elements[$this->definition['webform_submission_field']]); - - // Hiding the title, since it is probably included on the views level. - $elements[$this->definition['webform_submission_field']]['#title_display'] = 'invisible'; - $elements[$this->definition['webform_submission_field']]['#format'] = $this->options['webform_element_format']; - - return $view_builder->buildElements($elements, $webform_submission, [ - 'excluded_elements' => $excluded_elements, - ]); - } - - return []; - } - - /** - * {@inheritdoc} - */ - public function query() { - // Since we will render the field off webform_submission entity, there is - // no need to join any table nor include any fields in the select. - } - - /** - * {@inheritdoc} - */ - public function clickSort($order) { - $webform_submission_data_alias = $this->ensureMyTable(); - $params = $this->options['group_type'] != 'group' ? ['function' => $this->options['group_type']] : []; - $this->query->addOrderBy($webform_submission_data_alias, 'value', $order, '', $params); - } - - /** - * Retrieve webform element plugin instance. - * - * @return \Drupal\webform\Plugin\WebformElementInterface - * Webform element plugin instance that corresponds to the webform element - * of this view field - */ - protected function getWebformElementPlugin() { - $webform = $this->entityTypeManager->getStorage('webform')->load($this->definition['webform_id']); - $element = $webform->getElement($this->definition['webform_submission_field']); - return $this->webformElementManager->getElementInstance($element); - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionFieldNumeric.php b/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionFieldNumeric.php deleted file mode 100644 index fc5075c82c..0000000000 --- a/web/modules/webform_views/src/Plugin/views/field/WebformSubmissionFieldNumeric.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\field; - -use Drupal\webform_views\Plugin\views\WebformSubmissionCastToNumberTrait; - -/** - * Webform submission numeric field. - * - * @ViewsField("webform_submission_field_numeric") - */ -class WebformSubmissionFieldNumeric extends WebformSubmissionField { - - use WebformSubmissionCastToNumberTrait; - - /** - * {@inheritdoc} - */ - public function clickSort($order) { - $this->ensureMyTable(); - - $field = $this->query->addField(NULL, $this->castToDataType($this->tableAlias . '.value'), $this->realField . '_sort'); - - $params = $this->options['group_type'] != 'group' ? ['function' => $this->options['group_type']] : []; - $this->query->addOrderBy(NULL, NULL, $order, $field, $params); - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionCheckboxFilter.php b/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionCheckboxFilter.php deleted file mode 100644 index 9df87506df..0000000000 --- a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionCheckboxFilter.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\filter; - -use Drupal\views\Plugin\views\filter\BooleanOperator; - -/** - * Filter for values of 'checkbox' webform element type. - * - * @ViewsFilter("webform_submission_checkbox_filter") - */ -class WebformSubmissionCheckboxFilter extends BooleanOperator { -} diff --git a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionFieldFilter.php b/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionFieldFilter.php deleted file mode 100644 index b8a1c98a74..0000000000 --- a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionFieldFilter.php +++ /dev/null @@ -1,265 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\filter; - -use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\ElementInfoManagerInterface; -use Drupal\views\Plugin\views\filter\StringFilter; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Filter based on value of a webform submission. - * - * @ViewsFilter("webform_submission_field_filter") - */ -class WebformSubmissionFieldFilter extends StringFilter { - - /** - * Constant that denotes using webform element type for value form. - * - * @var string - */ - const ELEMENT_TYPE = 'element'; - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * @var ElementInfoManagerInterface - */ - protected $elementInfoManager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('plugin.manager.element_info') - ); - } - - /** - * WebformSubmissionFieldFilter constructor. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ElementInfoManagerInterface $element_info_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->entityTypeManager = $entity_type_manager; - $this->elementInfoManager = $element_info_manager; - } - - /** - * {@inheritdoc} - */ - public function operatorForm(&$form, FormStateInterface $form_state) { - parent::operatorForm($form, $form_state); - - if (isset($form['operator'])) { - $do_ajax = TRUE; - - // We must guess the future #parents for this operator here. - if (!$this->isExposed()) { - $parents = ['options', 'operator']; - } - elseif (!$this->isAGroup()) { - // We cannot determine which row we are building, so we prefer to hold - // off ajax. - $do_ajax = FALSE; - $parents = []; - } - elseif ($this->options['expose']['use_operator']) { - $do_ajax = FALSE; - $parents = [$this->options['expose']['operator_id']]; - } - else { - // We shouldn't really fall into here. If we do, it means there is yet - // another unknown use case of this method. - $do_ajax = FALSE; - $parents = []; - } - $operator = NestedArray::getValue($form_state->getUserInput(), $parents); - if (!$operator || !isset($this->operators()[$operator])) { - $operator = $this->operator; - } - - if ($do_ajax) { - $process = $this->getFormElementProperty($form['operator'], '#process', []); - // We need to run before ajax process stuff since we dynamically insert - // the wrapper value for ajax. - array_unshift($process, [self::class, 'processOperatorForm']); - - $form['operator']['#ajax'] = [ - 'callback' => [self::class, 'ajaxValueForm'], - 'wrapper' => 'this-will-be-set-up-in-process', - ]; - $form['operator']['#process'] = $process; - } - else { - // We are in the scenario where Ajax will break. So we fall to some - // inoffensive (with relaxed validation) operator. - // See https://www.drupal.org/node/2804457 and - // https://www.drupal.org/node/2842525 for the bugs that force us to do - // it this way. - $operator = 'contains'; - } - - $form_state->set(['webform_views', 'filter_operator'], $operator); - } - } - - /** - * {@inheritdoc} - */ - public function valueForm(&$form, FormStateInterface $form_state) { - $webform = $this->entityTypeManager->getStorage('webform')->load($this->definition['webform_id']); - - $element = $webform->getElementInitialized($this->definition['webform_submission_field']); - $element['#default_value'] = $this->value; - $element['#required'] = FALSE; - - $operator = $form_state->get(['webform_views', 'filter_operator']) ?: $this->operator; - $operator_definition = $this->operators()[$operator]; - // Swap the type of value if the current operator dictates doing so. - if (isset($operator_definition['webform_views_element_type']) && $operator_definition['webform_views_element_type'] != self::ELEMENT_TYPE) { - $element['#type'] = $operator_definition['webform_views_element_type']; - } - - // Wrap the value with a container that will be used for AJAX. - $html_id = Html::getUniqueId($this->pluginId); - $form_state->set(['webform_views', 'filter_value_form_wrapper_id'], $html_id); - - $theme_wrappers = $this->getFormElementProperty($element, '#theme_wrappers', []); - $theme_wrappers['container'] = ['#attributes' => ['id' => $html_id]]; - $element['#theme_wrappers'] = $theme_wrappers; - - $process = $this->getFormElementProperty($element, '#process', []); - // We wanna run as the 1st process since we might change the type of the - // element and thus the ongoing processes may become obsolete. - array_unshift($process, [self::class, 'processValueForm']); - $element['#process'] = $process; - - // We will need the definition of operators in the process callback and at - // that moment we will in static context without access to methods of this - // object. So we thoughtfully attach definition of all operators to the form - // element itself. - $element['#webform_views_filter']['operators'] = $this->operators(); - - $form['value'] = $element; - } - - /** - * {@inheritdoc} - */ - public function acceptExposedInput($input) { - if (parent::acceptExposedInput($input)) { - if (empty($this->options['exposed'])) { - return TRUE; - } - - if (!empty($this->options['expose']['identifier'])) { - $value = $input[$this->options['expose']['identifier']]; - - return (bool) $value; - } - } - return FALSE; - } - - /** - * {@inheritdoc} - */ - function operators() { - $operators = parent::operators(); - - // We additionally mark each operator as whether it should use element form - // or just a text field. For example, when you filter by email, generally - // you want to use #type => 'email', i.e. the element form, but when you do - // "contains" or "regex" or similar operator, you want to have just a text - // field. - $operator_map = [ - '=' => self::ELEMENT_TYPE, - '!=' => self::ELEMENT_TYPE, - 'contains' => 'textfield', - 'word' => 'textfield', - 'allwords' => 'textfield', - 'starts' => 'textfield', - 'not_starts' => 'textfield', - 'ends' => 'textfield', - 'not_ends' => 'textfield', - 'not' => 'textfield', - 'shorterthan' => 'number', - 'longerthan' => 'number', - 'regular_expression' => 'textfield', - ]; - - foreach ($operators as $k => $v) { - if (isset($operator_map[$k])) { - $operators[$k]['webform_views_element_type'] = $operator_map[$k]; - } - } - - return $operators; - } - - /** - * Form process for ::operatorForm() method. - */ - public static function processOperatorForm($element, FormStateInterface $form_state, $form) { - $element['#ajax']['wrapper'] = $form_state->get(['webform_views', 'filter_value_form_wrapper_id']); - return $element; - } - - /** - * Form process for ::valueForm() method. - */ - public static function processValueForm($element, FormStateInterface $form_state, $form) { - // Store the location of value form within the whole $form so ajax callback - // has better time finding it. - $form_state->set(['webform_views', 'filter_value_form_array_parents'], $element['#array_parents']); - - return $element; - } - - /** - * Ajax callback for operator form element. - */ - public static function ajaxValueForm($form, FormStateInterface $form_state) { - $value_form = NestedArray::getValue($form, $form_state->get(['webform_views', 'filter_value_form_array_parents'])); - - // Views sets its #prefix and #suffix for CSS purposes. - unset($value_form['#prefix'], $value_form['#suffix']); - - return $value_form; - } - - /** - * Extract a property of a form element. - * - * @param array $element - * Form element whose property to extract - * @param string $property - * Property to extract - * @param mixed $default - * Default value to use when the property is not defined in the provided - * element - * - * @return mixed - * The property value extracted from form element - */ - protected function getFormElementProperty($element, $property, $default) { - if (isset($element[$property])) { - return $element[$property]; - } - - return $this->elementInfoManager->getInfoProperty($element['#type'], $property, $default); - } -} diff --git a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php b/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php deleted file mode 100644 index 6dac883efb..0000000000 --- a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\filter; - -use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\ElementInfoManagerInterface; -use Drupal\views\Plugin\views\filter\NumericFilter; -use Drupal\webform_views\Plugin\views\WebformSubmissionCastToNumberTrait; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Filter based on numeric value of a webform submission. - * - * Since webform submission values are stored as string, we introduce additional - * following definition properties to this handler: - * - explicit_cast: (bool) Whether the values should be explicitly casted to a - * number in the views query - * - * @ViewsFilter("webform_submission_numeric_filter") - */ -class WebformSubmissionNumericFilter extends NumericFilter { - - use WebformSubmissionCastToNumberTrait; - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * @var ElementInfoManagerInterface - */ - protected $elementInfoManager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('plugin.manager.element_info') - ); - } - - /** - * WebformSubmissionFieldFilter constructor. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ElementInfoManagerInterface $element_info_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->entityTypeManager = $entity_type_manager; - $this->elementInfoManager = $element_info_manager; - } - - /** - * {@inheritdoc} - */ - public function valueForm(&$form, FormStateInterface $form_state) { - parent::valueForm($form, $form_state); - - $webform = $this->entityTypeManager->getStorage('webform')->load($this->definition['webform_id']); - - // A set of possible locations where webform element widget might have to - // be inserted. - $possible_locations = []; - $possible_locations[] = ['value']; - $possible_locations[] = ['value', 'value']; - $possible_locations[] = ['value', 'min']; - $possible_locations[] = ['value', 'max']; - - foreach ($possible_locations as $possible_location) { - $key_exists = FALSE; - $element = &NestedArray::getValue($form, $possible_location, $key_exists); - if ($key_exists && isset($element['#type']) && $element['#type'] != 'value') { - $default_value = end($possible_location); - $default_value = isset($this->value[$default_value]) ? $this->value[$default_value] : NULL; - $element = [ - '#title' => $element['#title'], - '#default_value' => $default_value, - '#required' => FALSE, - '#states' => $element['#states'], - ] + $webform->getElementInitialized($this->definition['webform_submission_field']); - } - } - } - - /** - * {@inheritdoc} - */ - public function opSimple($field) { - if ($this->definition['explicit_cast']) { - $this->query->addWhereExpression($this->options['group'], $this->castToDataType($field) . ' ' . $this->operator . ' ' . $this->castToDataType(':value'), [ - ':value' => $this->value['value'], - ]); - } - else { - parent::opSimple($field); - } - } - - /** - * {@inheritdoc} - */ - public function opBetween($field) { - if ($this->definition['explicit_cast']) { - $operator = $this->operator == 'between' ? 'BETWEEN' : 'NOT BETWEEN'; - $this->query->addWhereExpression($this->options['group'], $this->castToDataType($field) . ' ' . $operator . ' ' . $this->castToDataType(':min') . ' AND ' . $this->castToDataType(':max'), [ - ':min' => $this->value['min'], - ':max' => $this->value['max'], - ]); - } - else { - parent::opBetween($field); - } - } - - /** - * {@inheritdoc} - */ - public function acceptExposedInput($input) { - if (parent::acceptExposedInput($input)) { - if (empty($this->options['exposed'])) { - return TRUE; - } - - if (!empty($this->options['expose']['identifier'])) { - $value = $input[$this->options['expose']['identifier']]; - - return (bool) $value; - } - } - return FALSE; - } - - /** - * {@inheritdoc} - */ - function operators() { - $operators = parent::operators(); - unset($operators['regular_expression']); - - return $operators; - } - - /** - * Extract a property of a form element. - * - * @param array $element - * Form element whose property to extract - * @param string $property - * Property to extract - * @param mixed $default - * Default value to use when the property is not defined in the provided - * element - * - * @return mixed - * The property value extracted from form element - */ - protected function getFormElementProperty($element, $property, $default) { - if (isset($element[$property])) { - return $element[$property]; - } - - return $this->elementInfoManager->getInfoProperty($element['#type'], $property, $default); - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionSelectFilter.php b/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionSelectFilter.php deleted file mode 100644 index ffe853fcd0..0000000000 --- a/web/modules/webform_views/src/Plugin/views/filter/WebformSubmissionSelectFilter.php +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\filter; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\filter\InOperator; -use Drupal\webform_views\Plugin\views\WebformSubmissionTrait; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Select filter based on value of a webform submission. - * - * @ViewsFilter("webform_submission_select_filter") - */ -class WebformSubmissionSelectFilter extends InOperator { - - use WebformSubmissionTrait; - - /** - * Denote the option of "all" options. - * - * @var string - */ - const ALL = 'all'; - - protected $valueFormType = 'select'; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager') - ); - } - - /** - * WebformSubmissionFieldFilter constructor. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - public function valueForm(&$form, FormStateInterface $form_state) { - parent::valueForm($form, $form_state); - $form['value']['#required'] = FALSE; - unset($form['value']['#options'][self::ALL]); - } - - /** - * {@inheritdoc} - */ - public function showValueForm(&$form, FormStateInterface $form_state) { - parent::showValueForm($form, $form_state); - $form['value']['#options'] = [self::ALL => $this->valueOptions[self::ALL]] + $form['value']['#options']; - } - - /** - * {@inheritdoc} - */ - public function getValueOptions() { - if (!isset($this->valueOptions)) { - $webform = $this->entityTypeManager->getStorage('webform')->load($this->definition['webform_id']); - $element = $webform->getElementInitialized($this->definition['webform_submission_field']); - - // We need this explicit "all" option because otherwise - // InOperator::validate() rises validation errors when we are an exposed - // required filter without default value nor without submitted exposed - // input. - $this->valueOptions = [self::ALL => $this->t('All')]; - $this->valueOptions += $element['#options']; - } - return $this->valueOptions; - } - - /** - * {@inheritdoc} - */ - public function acceptExposedInput($input) { - $accept = parent::acceptExposedInput($input); - $identifier = $this->options['expose']['identifier']; - if ($input[$identifier] == self::ALL) { - return FALSE; - } - return $accept; - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldNumericSort.php b/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldNumericSort.php deleted file mode 100644 index db0508f9f0..0000000000 --- a/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldNumericSort.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\sort; - -use Drupal\views\Plugin\views\sort\SortPluginBase; -use Drupal\webform_views\Plugin\views\WebformSubmissionCastToNumberTrait; - -/** - * Sorting by numeric webform submission field. - * - * @ViewsSort("webform_submission_field_numeric_sort") - */ -class WebformSubmissionFieldNumericSort extends SortPluginBase { - - use WebformSubmissionCastToNumberTrait; - - /** - * {@inheritdoc} - */ - public function query() { - $this->ensureMyTable(); - - $field = $this->query->addField(NULL, $this->castToDataType($this->tableAlias . '.' . $this->realField), $this->realField . '_sort'); - $this->query->addOrderBy(NULL, NULL, $this->options['order'], $field); - } - -} diff --git a/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldSort.php b/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldSort.php deleted file mode 100644 index 16de6d91ee..0000000000 --- a/web/modules/webform_views/src/Plugin/views/sort/WebformSubmissionFieldSort.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Drupal\webform_views\Plugin\views\sort; - -use Drupal\views\Plugin\views\sort\SortPluginBase; - -/** - * Sorting by webform submission field. - * - * @ViewsSort("webform_submission_field_sort") - */ -class WebformSubmissionFieldSort extends SortPluginBase { - -} diff --git a/web/modules/webform_views/src/Routing/RouteSubscriber.php b/web/modules/webform_views/src/Routing/RouteSubscriber.php deleted file mode 100644 index 7201ca3803..0000000000 --- a/web/modules/webform_views/src/Routing/RouteSubscriber.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -namespace Drupal\webform_views\Routing; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Routing\RouteSubscriberBase; -use Drupal\Core\State\StateInterface; -use Symfony\Component\Routing\RouteCollection; - -/** - * Alter the routes in order to allow multiple views on the same route. - * - * Alter the routes so '{webform}' parameter is present and defaults to the - * corresponding webform for all views that are related to webform submissions. - */ -class RouteSubscriber extends RouteSubscriberBase { - - /** - * @var StateInterface - */ - protected $state; - - /** - * @var EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * RouteSubscriber constructor. - */ - public function __construct(StateInterface $state, EntityTypeManagerInterface $entity_type_manager) { - $this->state = $state; - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - protected function alterRoutes(RouteCollection $collection) { - $view_route_names = $this->state->get('views.view_route_names'); - - foreach (webform_views_applicable_views() as $trio) { - list($view_id, $display_id, $path) = $trio; - - $route_name = $view_route_names[$view_id . '.' . $display_id]; - - if (($route = $collection->get($route_name)) && ($webform_id = webform_views_webform_id_from_path($path))) { - $route->setPath($route->getPath() . '/{webform}'); - $route->setDefault('webform', $webform_id); - $options = $route->getOptions(); - $options['parameters']['webform']['type'] = 'entity:webform'; - $route->setOptions($options); - } - } - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformCheckboxViews.php b/web/modules/webform_views/src/WebformElementViews/WebformCheckboxViews.php deleted file mode 100644 index 78fe5d68d6..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformCheckboxViews.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\webform\Plugin\WebformElementInterface; - -/** - * Webform views handler for checkbox webform elements. - */ -class WebformCheckboxViews extends WebformElementViewsAbstract { - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - $views_data = parent::getElementViewsData($element_plugin, $element); - - $views_data['filter'] = [ - 'id' => 'webform_submission_checkbox_filter', - 'real field' => 'value', - ]; - - return $views_data; - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformDateViews.php b/web/modules/webform_views/src/WebformElementViews/WebformDateViews.php deleted file mode 100644 index 5719188967..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformDateViews.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\webform\Plugin\WebformElementInterface; - -/** - * Webform views handler for date-based webform elements. - */ -class WebformDateViews extends WebformDefaultViews { - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - $views_data = parent::getElementViewsData($element_plugin, $element); - - $views_data['filter'] = [ - 'id' => 'webform_submission_numeric_filter', - 'real field' => 'value', - 'explicit_cast' => FALSE, - ]; - - return $views_data; - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformDefaultViews.php b/web/modules/webform_views/src/WebformElementViews/WebformDefaultViews.php deleted file mode 100644 index 0eafb20c74..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformDefaultViews.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\Component\Utility\Html; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\webform\Plugin\WebformElementInterface; -use Drupal\webform\WebformInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Default webform views handler for webform elements. - */ -class WebformDefaultViews extends WebformElementViewsAbstract { - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - $views_data = parent::getElementViewsData($element_plugin, $element); - - if ($element_plugin->isInput($element) && !$element_plugin->hasMultipleValues($element)) { - $views_data['sort'] = [ - 'id' => 'webform_submission_field_sort', - 'real field' => 'value', - ]; - } - - if ($element_plugin->isInput($element) && !$element_plugin->hasMultipleValues($element)) { - $views_data['filter'] = [ - 'id' => 'webform_submission_field_filter', - 'real field' => 'value', - ]; - } - - return $views_data; - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformElementViewsAbstract.php b/web/modules/webform_views/src/WebformElementViews/WebformElementViewsAbstract.php deleted file mode 100644 index ea3999606c..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformElementViewsAbstract.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\Component\Utility\Html; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\webform\Plugin\WebformElementInterface; -use Drupal\webform\Plugin\WebformElementManagerInterface; -use Drupal\webform\WebformInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Abstract implementation of webform element views handler. - */ -abstract class WebformElementViewsAbstract implements WebformElementViewsInterface, ContainerInjectionInterface { - - use StringTranslationTrait; - - /** - * Webform submission entity type. - * - * @var EntityTypeInterface - */ - protected $entityType; - - /** - * @var WebformElementManagerInterface - */ - protected $webformElementManager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity_type.manager')->getDefinition('webform_submission'), - $container->get('plugin.manager.webform.element') - ); - } - - /** - * WebformElementViewsAbstract constructor. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - */ - public function __construct(EntityTypeInterface $entity_type, WebformElementManagerInterface $webform_element_manager) { - $this->entityType = $entity_type; - $this->webformElementManager = $webform_element_manager; - } - - /** - * {@inheritdoc} - */ - public function getViewsData($element, WebformInterface $webform) { - $table_alias = 'webform_submission_field_' . $webform->id() . '_' . $element['#webform_key']; - $element_title = (isset($element['#title']) && $element['#title']) ? $element['#title'] : $element['#webform_key']; - $element_plugin = $this->webformElementManager->getElementInstance($element); - - $data[$table_alias]['table']['group'] = $this->t('Webform @webform submission data', [ - '@webform' => $webform->label(), - ]); - - // For each webform submission element we create a table alias and then - // explain to Views how to join {webform_submission_data} onto - // {webform_submission}. - $data[$table_alias]['table']['join'][$this->entityType->getBaseTable()] = [ - 'table' => 'webform_submission_data', - 'field' => 'sid', - 'left_field' => 'sid', - 'extra' => [ - ['field' => 'name', 'value' => $element['#webform_key']], - ], - ]; - - $data[$table_alias]['webform_submission_value'] = [ - 'title' => Html::escape($element_title), - 'help' => $this->t('Value of the field %field in webform %webform submission.', [ - '%field' => $element_title, - '%webform' => $webform->label(), - ]), - ]; - - foreach ($this->getElementViewsData($element_plugin, $element) as $k => $v) { - $v += [ - 'webform_id' => $webform->id(), - 'webform_submission_field' => $element['#webform_key'], - ]; - $data[$table_alias]['webform_submission_value'][$k] = $v; - } - - return $data; - } - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - return [ - 'field' => [ - 'id' => 'webform_submission_field', - 'real field' => $this->entityType->getKey('id'), - 'click sortable' => !$element_plugin->isContainer($element) && !$element_plugin->hasMultipleValues($element), - 'multiple' => $element_plugin->hasMultipleValues($element), - ], - ]; - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformElementViewsInterface.php b/web/modules/webform_views/src/WebformElementViews/WebformElementViewsInterface.php deleted file mode 100644 index ba34a79871..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformElementViewsInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\webform\Plugin\WebformElementInterface; -use Drupal\webform\WebformInterface; - -/** - * Interface of webform element views handler. - */ -interface WebformElementViewsInterface { - - /** - * Generate views data related to a given element of a given webform. - * - * @param array $element - * Webform element whose views data is queried - * @param \Drupal\webform\WebformInterface $webform - * Webform within which the element is found - * - * @return array - * Views data array that corresponds to the provided webform element - */ - public function getViewsData($element, WebformInterface $webform); - - /** - * Generate views data definition that corresponds to given webform element. - * - * @param \Drupal\webform\Plugin\WebformElementInterface $element_plugin - * Webform element plugin whose views data definition is requested - * @param array $element - * Webform element whose views data definition is requested - * - * @return array - * Views data definition array that corresponds to the given webform - * element. The structure of this array should have the following structure: - * - field: (array) Views data 'field' section to use for this webform - * element - * - filter: (array) Views data 'filter' section to use for this webform - * element - * - sort: (array) Views data 'sort' section to use for this webform element - * - TODO: Do you need more here? - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element); - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformManagedFileViews.php b/web/modules/webform_views/src/WebformElementViews/WebformManagedFileViews.php deleted file mode 100644 index 776e4c6518..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformManagedFileViews.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -/** - * Default webform views handler for managed file webform elements. - */ -class WebformManagedFileViews extends WebformElementViewsAbstract { -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformNumericViews.php b/web/modules/webform_views/src/WebformElementViews/WebformNumericViews.php deleted file mode 100644 index 87110b68bc..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformNumericViews.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\webform\Plugin\WebformElementInterface; - -/** - * Webform views handler for numeric webform elements. - */ -class WebformNumericViews extends WebformDefaultViews { - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - $views_data = parent::getElementViewsData($element_plugin, $element); - - $views_data['field']['id'] = 'webform_submission_field_numeric'; - $views_data['sort']['id'] = 'webform_submission_field_numeric_sort'; - - $views_data['filter'] = [ - 'id' => 'webform_submission_numeric_filter', - 'real field' => 'value', - 'explicit_cast' => TRUE, - ]; - - return $views_data; - } - -} diff --git a/web/modules/webform_views/src/WebformElementViews/WebformSelectViews.php b/web/modules/webform_views/src/WebformElementViews/WebformSelectViews.php deleted file mode 100644 index 4763345cf5..0000000000 --- a/web/modules/webform_views/src/WebformElementViews/WebformSelectViews.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\webform_views\WebformElementViews; - -use Drupal\webform\Plugin\WebformElementInterface; - -/** - * Webform views handler for select webform elements. - */ -class WebformSelectViews extends WebformElementViewsAbstract { - - /** - * {@inheritdoc} - */ - public function getElementViewsData(WebformElementInterface $element_plugin, array $element) { - $views_data = parent::getElementViewsData($element_plugin, $element); - - $views_data['filter'] = [ - 'id' => 'webform_submission_select_filter', - 'real field' => 'value', - ]; - - return $views_data; - } - -} diff --git a/web/modules/webform_views/src/WebformSubmissionViewsData.php b/web/modules/webform_views/src/WebformSubmissionViewsData.php deleted file mode 100644 index 93e05113cf..0000000000 --- a/web/modules/webform_views/src/WebformSubmissionViewsData.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -namespace Drupal\webform_views; - -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\StringTranslation\TranslationInterface; -use Drupal\webform\Plugin\WebformElementManagerInterface; -use Drupal\webform\WebformInterface; -use Drupal\webform\WebformSubmissionViewsData as WebformSubmissionViewsDataBase; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Views data for 'webform_submission' entity type. - */ -class WebformSubmissionViewsData extends WebformSubmissionViewsDataBase { - - /** - * @var WebformElementManagerInterface - */ - protected $webformElementManager; - - /** - * @var EntityStorageInterface - */ - protected $webformStorage; - - /** - * {@inheritdoc} - */ - public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { - return new static( - $entity_type, - $container->get('entity.manager')->getStorage($entity_type->id()), - $container->get('entity.manager'), - $container->get('module_handler'), - $container->get('string_translation'), - $container->get('plugin.manager.webform.element'), - $container->get('entity_type.manager')->getStorage('webform') - ); - } - - /** - * WebformSubmissionViewsData constructor. - */ - public function __construct(EntityTypeInterface $entity_type, SqlEntityStorageInterface $storage_controller, EntityManagerInterface $entity_manager, ModuleHandlerInterface $module_handler, TranslationInterface $translation_manager, WebformElementManagerInterface $webform_element_manager, EntityStorageInterface $webform_storage) { - parent::__construct($entity_type, $storage_controller, $entity_manager, $module_handler, $translation_manager); - - $this->webformElementManager = $webform_element_manager; - $this->webformStorage = $webform_storage; - } - - /** - * {@inheritdoc} - */ - public function getViewsData() { - $data = parent::getViewsData(); - - $base_table = $this->entityType->getBaseTable() ?: $this->entityType->id(); - - // Reverse relationship on the "entity_type" and "entity_id" columns, i.e. - // from an arbitrary entity to webform submissions that have been submitted - // to it. - foreach ($this->entityManager->getDefinitions() as $definition) { - if ($definition instanceof ContentEntityTypeInterface) { - $relationship = [ - 'base' => $base_table, - 'field' => $definition->getKey('id'), - 'base field' => 'entity_id', - 'id' => 'standard', - 'extra' => [ - ['field' => 'entity_type', 'value' => $definition->id()], - ], - ]; - - // Depending on whether the foreign entity has data table we join on its - // data table or on its base table. Additionally, if it we join on the - // data table, then we also must join on langcode column. - if ($definition->getDataTable()) { - $foreign_table = $definition->getDataTable(); - $relationship['extra'][] = ['field' => 'langcode', 'left_field' => 'langcode']; - } - else { - $foreign_table = $definition->getBaseTable(); - } - - $data[$foreign_table]['webform_submission'] = [ - 'title' => $this->t('Webform submissions'), - 'help' => $this->t('Webform submissions submitted to an entity.'), - ]; - - $data[$foreign_table]['webform_submission']['relationship'] = $relationship; - } - } - - foreach ($this->webformStorage->loadMultiple() as $webform) { - foreach ($webform->getElementsInitializedAndFlattened() as $element) { - $data = array_replace_recursive($data, $this->getWebformElementViewsData($element, $webform)); - } - } - - return $data; - } - - /** - * Collect webform element views data. - * - * @param array $element - * Element whose views data is to be collected - * @param \Drupal\webform\WebformInterface $webform - * Webform where $element belongs to - * - * @return array - * Views data that corresponds to the provided $element - */ - protected function getWebformElementViewsData($element, WebformInterface $webform) { - $data = []; - - $element_plugin = $this->webformElementManager->getElementInstance($element); - if (isset($element_plugin->getPluginDefinition()['webform_views_handler'])) { - $views_handler_class = $element_plugin->getPluginDefinition()['webform_views_handler']; - $this->moduleHandler->alter('webform_views_element_views_handler', $views_handler_class, $element, $webform); - if (is_subclass_of($views_handler_class, ContainerInjectionInterface::class)) { - $views_handler = $views_handler_class::create(\Drupal::getContainer()); - } - else { - $views_handler = new $views_handler_class(); - } - $data = $views_handler->getViewsData($element, $webform); - } - - return $data; - } - -} diff --git a/web/modules/webform_views/webform_views.api.php b/web/modules/webform_views/webform_views.api.php deleted file mode 100644 index 8af2f0325e..0000000000 --- a/web/modules/webform_views/webform_views.api.php +++ /dev/null @@ -1,29 +0,0 @@ - <?php - -/** - * @file - * Documentation of webform views module. - */ - -/** - * Alter webform element views handler. - * - * You may use this hook to specify special handlers on per-element and/or - * per-webform basis while not affecting the rest of webform element handlers. - * On the other hand, if you want to specify a new "default" views handler class - * for a webform element, you are advised to it via - * hook_webform_element_info_alter() instead. See - * webform_views_webform_element_info_alter() for sample code. - * - * @param string $views_handler_class - * Name of the current webform element views handler class - * @param array $element - * Webform element whose views handler is being altered - * @param \Drupal\webform\WebformInterface $webform - * Webform where $element belongs to - */ -function hook_webform_views_element_views_handler(&$views_handler_class, $element, \Drupal\webform\WebformInterface $webform) { - if ($webform->id() == 'my_special_webform' && $element['#webform_key'] == 'my_special_webform_element') { - $views_handler_class = '\Drupal\custom\WebformElementViews\MySpecialHandler'; - } -} diff --git a/web/modules/webform_views/webform_views.info.yml b/web/modules/webform_views/webform_views.info.yml deleted file mode 100644 index 306363c89b..0000000000 --- a/web/modules/webform_views/webform_views.info.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'Webform views' -description: 'Webform integration with views.' -# core: '8.x' -package: 'Webform' -type: module -dependencies: - - webform - - views - -# Information added by Drupal.org packaging script on 2017-07-01 -version: '8.x-5.0-alpha2' -core: '8.x' -project: 'webform_views' -datestamp: 1498870445 diff --git a/web/modules/webform_views/webform_views.links.task.yml b/web/modules/webform_views/webform_views.links.task.yml deleted file mode 100644 index 5437fc5447..0000000000 --- a/web/modules/webform_views/webform_views.links.task.yml +++ /dev/null @@ -1,3 +0,0 @@ -webform_view: - class: Drupal\Core\Menu\LocalTaskDefault - deriver: \Drupal\webform_views\Plugin\Derivative\ViewsLocalTask diff --git a/web/modules/webform_views/webform_views.module b/web/modules/webform_views/webform_views.module deleted file mode 100644 index c373616363..0000000000 --- a/web/modules/webform_views/webform_views.module +++ /dev/null @@ -1,185 +0,0 @@ -<?php - -/** - * @file - * Webform integration with views. - */ - -/** - * Implements hook_module_implements_alter(). - */ -function webform_views_module_implements_alter(&$implementations, $hook) { - // We need to run hook_local_tasks_alter() after views' implementation of the - // same hook. - switch ($hook) { - case 'local_tasks_alter': - $group = $implementations['webform_views']; - unset($implementations['webform_views']); - $implementations['webform_views'] = $group; - break; - } -} - -/** - * Implements hook_entity_type_alter(). - */ -function webform_views_entity_type_alter(array &$entity_types) { - $entity_types['webform_submission']->setHandlerClass('views_data', \Drupal\webform_views\WebformSubmissionViewsData::class); -} - -/** - * Implements hook_ENTITY_TYPE_presave(). - */ -function webform_views_webform_presave(\Drupal\webform\Entity\Webform $entity) { - // Rebuild views data if there is any sensitive change in our webforms setup. - if ($entity->isNew() || $entity->getElementsRaw() != $entity->original->getElementsRaw()) { - \Drupal\views\Views::viewsData()->clear(); - } -} - -/** - * Implements hook_ENTITY_TYPE_delete(). - */ -function webform_views_webform_delete(\Drupal\webform\Entity\Webform $entity) { - \Drupal\views\Views::viewsData()->clear(); -} - -/** - * Implements hook_webform_element_info_alter(). - */ -function webform_views_webform_element_info_alter(array &$elements) { - foreach ($elements as $k => $v) { - $views_handler = FALSE; - - // All file-based webform elements have special views handler by default. - if (is_subclass_of($v['class'], \Drupal\webform\Plugin\WebformElement\WebformManagedFileBase::class, TRUE)) { - $views_handler = \Drupal\webform_views\WebformElementViews\WebformManagedFileViews::class; - } - - switch ($k) { - case 'select': - $views_handler = \Drupal\webform_views\WebformElementViews\WebformSelectViews::class; - break; - - case 'checkbox': - $views_handler = \Drupal\webform_views\WebformElementViews\WebformCheckboxViews::class; - break; - - case 'date': - $views_handler = \Drupal\webform_views\WebformElementViews\WebformDateViews::class; - break; - - case 'number': - $views_handler = \Drupal\webform_views\WebformElementViews\WebformNumericViews::class; - break; - - default: - if (!$views_handler) { - $views_handler = \Drupal\webform_views\WebformElementViews\WebformDefaultViews::class; - } - break; - } - - if ($views_handler) { - $elements[$k]['webform_views_handler'] = $views_handler; - } - } -} - -/** - * Implements hook_local_tasks_alter(). - */ -function webform_views_local_tasks_alter(&$local_tasks) { - $container = \Drupal::getContainer(); - $local_task = \Drupal\webform_views\Plugin\Derivative\ViewsLocalTask::create($container, 'views_view'); - $local_task->alterLocalTasks($local_tasks); -} - -/** - * Implements hook_menu_local_tasks_alter(). - */ -function webform_views_menu_local_tasks_alter(&$data, $route_name) { - $webform = \Drupal::routeMatch()->getParameter('webform'); - if ($webform && \Drupal::routeMatch()->getRouteName() == $route_name) { - // We have all the necessary data: we are manipulating current request and - // we know which webform is invoked. So we can safely hide the webform views - // tabs that relate to the webforms that are not the current one. - foreach ($data['tabs'] as $level => $tabs_per_level) { - foreach ($tabs_per_level as $k => $tab) { - if (substr($k, 0, strlen('webform_view:')) == 'webform_view:') { - $tab_webform = webform_views_webform_id_from_path($tab['#link']['url']->getInternalPath()); - if ($tab_webform != $webform->id()) { - $data['tabs'][$level][$k]['#access'] = new \Drupal\Core\Access\AccessResultForbidden(); - } - } - } - } - } -} - -/** - * Return a list of all views applicable for routing manipulation. - * - * @return array - * A list of arrays containing the $view and $display_id and $path (path where - * this view is available as a page) - * - * @code - * [ - * [$view, $display_id, $path], - * [$view, $display_id, $path], - * ]; - * @endcode - */ -function webform_views_applicable_views() { - $return = []; - foreach (\Drupal\views\Views::getApplicableViews('uses_menu_links') as $pair) { - list($view_id, $display_id) = $pair; - /** @var $executable \Drupal\views\ViewExecutable */ - $executable = \Drupal::entityTypeManager()->getStorage('view')->load($view_id)->getExecutable(); - - $executable->setDisplay($display_id); - $menu = $executable->display_handler->getOption('menu'); - - // TODO: in theory we should do a more intensive analysis than just - // comparing the base entity type of the view. For example, what if - // relationships are used and thus webform submission is introduced into the - // view while the base entity type may be different. Though hardly we will - // see such use cases in real world practice. - if ($executable->getBaseEntityType() && $executable->getBaseEntityType()->id() == 'webform_submission' && in_array($menu['type'], ['tab', 'default tab'])) { - $return[] = [$view_id, $display_id, $executable->display_handler->getPath()]; - } - } - - return $return; -} - -/** - * Retrieve webform ID from a views path. - * - * @param string $path - * Path where webform ID to extract from - * - * @return string - * Webform ID if one is encountered in the provided $path, NULL otherwise - */ -function webform_views_webform_id_from_path($path) { - $path = explode('/', $path); - - // Strip the last path chunk, this way we should be one level above the - // current. - array_pop($path); - - // Try each chunk of the path seeing if it is not actually a webform - // id. - foreach ($path as $k => $v) { - $webform = \Drupal::entityTypeManager() - ->getStorage('webform') - ->load(str_replace('-', '_', $v)); - if ($webform) { - return $webform->id(); - } - } - - return NULL; -} diff --git a/web/modules/webform_views/webform_views.services.yml b/web/modules/webform_views/webform_views.services.yml deleted file mode 100644 index bc52c445df..0000000000 --- a/web/modules/webform_views/webform_views.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - webform_views.route_subscriber: - class: Drupal\webform_views\Routing\RouteSubscriber - arguments: [ '@state', '@entity_type.manager' ] - tags: - - { name: event_subscriber } -- GitLab