Webform module and config export

This commit is contained in:
Rob Davies 2017-03-16 15:29:07 +00:00
parent 3e6a5cbed2
commit 0e15467384
1040 changed files with 117682 additions and 0 deletions

View file

@ -0,0 +1,9 @@
*.patch
interdiff-*.txt
# Ignore all *.features.yml in 'modules' directory.
# NOTE: *.features.yml are not ignored with 'test/modules' directory.
webform.features.yml
modules/webform_examples/webform_examples.features.yml
modules/webform_templates/webform_templates.features.yml
modules/webform_node/webform_node.features.yml

View file

@ -0,0 +1,339 @@
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.

View file

@ -0,0 +1,112 @@
Webform 8.x-5.x
---------------
### About this Module
The Webform module is a form builder and submission manager for Drupal 8.
The primary use case for this module is to:
- **Build** a new webform or duplicate an existing template
- **Publish** the webform as a page, node, or block
- **Collect** submissions
- **Send** confirmations and notifications
- **Review** submissions online
- **Download** submissions as a CSV
### Goals
- A comprehensive form and survey building solution for Drupal 8.
- A stable, maintainable, and tested API for building forms and handling submission.
- A pluggable/extensible API for custom form elements and submission handling.
### Demo
> [Watch a demo](http://youtu.be/sQGsfQ_LZJ4) of the Webform module.
> Evaluate this project online using [simplytest.me](https://simplytest.me/project/drupal/8.2.x?add[]=webform).
### Presentations, Blog Posts, & Articles
- [Webform 8.x-5.x @ NJ DrupalCamp](https://www.drupalcampnj.org/program/sessions/building-webforms-drupal-8)
- [Getting NYU onto Webform](https://www.fourkitchens.com/blog/article/getting-nyu-yaml-form)
- [Webforms for Drupal 8](https://www.gaiaresources.com.au/yaml-forms-drupal-8/)
- [Creating Webform Handlers in Drupal 8](http://fivemilemedia.co.uk/blog/creating-yaml-form-handlers-drupal-8)
- [Les formulaires en Drupal 8](https://makina-corpus.com/blog/metier/2016/les-formulaires-en-drupal-8)
### Installing the Webform Module
1. Copy/upload the webform module to the modules directory of your Drupal
installation.
2. Enable the 'Webform' module and desired sub-modules in 'Extend'.
(/admin/modules)
3. Set up user permissions. (/admin/people/permissions#module-webform)
4. Build a new webform (/admin/structure/webform)
or duplicate an existing template (/admin/structure/webform/templates).
5. Publish your webform as a:
- **Page:** By linking to the published webform.
(/webform/contact)
- **Node:** By creating a new node that references the webform.
(/node/add/webform)
- **Block:** By placing a Webform block on your site.
(/admin/structure/block)
6. (optional) Install third party libraries(/admin/help/webform).
7. (optional) Install add-on contrib modules](/admin/structure/webform/addons).
### Releases
Even though the Webform module is still under active development with
regular [beta releases](https://www.drupal.org/documentation/version-info/alpha-beta-rc),
all existing configuration and submission data will be maintained and updated
between releases. **APIs can and will be changing** while this module moves
from beta releases to a final release candidate.
Simply put, if you install and use the Webform module out of the box AS-IS,
you _should_ be okay. Once you start extending webforms with plugins, altering
hooks, and overriding templates, you will need to read each release's
notes and assume that _things will be changing_.
### Project Status
- [Webform Project Board](https://contribkanban.com/board/webform/8.x-5.x)
- [Webform 4.x features currently missing from the Webform module](https://www.drupal.org/node/2807571)
### Similar Modules
- **[Comparison of Webform Building Modules](https://www.drupal.org/node/2083353)**
Drupal has a lot of modules aimed at helping site builders and users add webforms
to their sites. The [Comparison of Webform Building Modules](https://www.drupal.org/node/2083353)
page includes rough comparisons of three of them for Drupal 8 and five of them
for Drupal 7.
---
- **[Contact](https://www.drupal.org/documentation/modules/contact) +
[Contact Storage](https://www.drupal.org/project/contact_storage)**
The Contact module allows site visitors to send emails to other authenticated
users and to the site administrator. The Contact Storage module provides
storage for Contact messages which are fully-fledged entities in Drupal 8.
Many of its features are likely to be moved into Drupal Core.
- **[Eform](https://www.drupal.org/project/eform)**
The EForm module enables you to create front-end webforms (fieldable entities),
which contain fields that you define! These webforms use the standard Drupal
fields.
[Is this module still needed?](https://www.drupal.org/node/2809179)

View file

@ -0,0 +1,19 @@
{
"name": "drupal/webform",
"description": "Enables the creation of webforms and questionnaires.",
"type": "drupal-module",
"license": "GPL-2.0+",
"minimum-stability": "dev",
"homepage": "https://drupal.org/project/webform",
"authors": [
{
"name": "Jacob Rockowitz (jrockowitz)",
"homepage": "https://www.drupal.org/u/jrockowitz",
"role": "Maintainer"
}
],
"support": {
"issues": "https://drupal.org/project/issues/webform",
"source": "http://cgit.drupalcode.org/webform"
}
}

View file

@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
module:
- webform
id: webform_submission_delete_action
label: 'Delete submission'
type: webform_submission
plugin: webform_submission_delete_action
configuration: { }

View file

@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
module:
- webform
id: webform_submission_make_sticky_action
label: 'Star/Flag submission'
type: webform_submission
plugin: webform_submission_make_sticky_action
configuration: { }

View file

@ -0,0 +1,10 @@
langcode: en
status: true
dependencies:
module:
- webform
id: webform_submission_make_unsticky_action
label: 'Unstar/unflag submission'
type: webform_submission
plugin: webform_submission_make_unsticky_action
configuration: { }

View file

@ -0,0 +1,208 @@
settings:
default_page_base_path: form
default_form_closed_message: 'Sorry...This form is closed to new submissions.'
default_form_exception_message: 'Unable to display this webform. Please contact the site administrator.'
default_form_submit_label: Submit
default_form_submit_once: false
default_form_confidential_message: 'This form is confidential. You must <a href="[site:login-url]/logout?destination=[current-page:url:relative]">Log out</a> to submit it.'
default_form_disable_back: false
default_form_unsaved: false
default_form_novalidate: false
default_form_details_toggle: true
form_classes: |
container-inline clearfix
form--inline clearfix
messages messages--error
messages messages--warning
messages messages--status
button_classes: ''
default_wizard_prev_button_label: '< Previous Page'
default_wizard_next_button_label: 'Next Page >'
default_wizard_start_label: Start
default_wizard_complete_label: Complete
default_preview_next_button_label: Preview
default_preview_prev_button_label: '< Previous'
default_preview_message: 'Please review your submission. Your submission is not complete until you press the "Submit" button!'
default_draft_button_label: 'Save Draft'
default_draft_saved_message: 'Submission saved. You may return to this form later and it will restore the current values.'
default_draft_loaded_message: 'A partially-completed form was found. Please complete the remaining portions.'
default_confirmation_message: 'New submission added to [webform:title].'
default_confirmation_back_label: 'Back to form'
confirmation_classes: |
messages messages--error
messages messages--warning
messages messages--status
confirmation_back_classes: |
button
default_limit_total_message: 'No more submissions are permitted.'
default_limit_user_message: 'No more submissions are permitted.'
assets:
css: ''
javascript: ''
export:
exporter: delimited
delimiter: ','
multiple_delimiter: ;
excel: false
file_name: 'submission-[webform_submission:serial]'
header_format: label
header_prefix: true
header_prefix_label_delimiter: ': '
header_prefix_key_delimiter: __
composite_element_item_format: label
options_format: compact
options_item_format: label
entity_reference_format: link
likert_answers_format: label
signature_format: status
batch:
default_batch_export_size: 500
default_batch_update_size: 500
default_batch_delete_size: 500
purge_settings:
cron_size: 100
elements:
allowed_tags: admin
wrapper_classes: |
container-inline clearfix
form--inline clearfix
messages messages--error
messages messages--warning
messages messages--status
classes: |
container-inline clearfix
form--inline clearfix
messages messages--error
messages messages--warning
messages messages--status
default_description_display: ''
default_google_maps_api_key: ''
excluded_types: { }
file:
file_public: false
default_max_filesize: ''
default_managed_file_extensions: 'gif jpg png bmp eps tif pict psd txt rtf html odf pdf doc docx ppt pptx xls xlsx xml avi mov mp3 ogg wav bz2 dmg gz jar rar sit svg tar zip'
default_audio_file_extensions: 'mp3 ogg wav'
default_document_file_extensions: 'txt rtf pdf doc docx odt ppt pptx odp xls xlsx ods'
default_image_file_extensions: 'gif jpg png svg'
default_video_file_extensions: 'avi mov mp4 ogg wav webm'
format: { }
mail:
default_from_mail: '[site:mail]'
default_from_name: '[site:name]'
default_subject: 'Webform submission from: [webform_submission:source-entity]'
default_body_text: |
Submitted on [webform_submission:created]
Submitted by: [webform_submission:user]
Submitted values are:
[webform_submission:values]
default_body_html: |
<p>Submitted on [webform_submission:created]</p>
<p>Submitted by: [webform_submission:user]</p>
<p>Submitted values are:</p>
[webform_submission:values]
test:
types: |
checkbox:
- true
color:
- '#ffffcc'
- '#ffffcc'
- '#ccffff'
date:
- '1942-06-18'
- '1940-07-07'
- '1943-02-25'
- '1940-10-09'
datetime:
- '1942-06-18'
- '1940-07-07'
- '1943-02-25'
- '1940-10-09'
datelist:
- '1942-06-18'
- '1940-07-07'
- '1943-02-25'
- '1940-10-09'
email:
- 'example@example.com'
- 'test@test.com'
- 'random@random.com'
language_select:
- en
machine_name:
- 'loremipsum'
- 'oratione'
- 'dixisset'
tel:
- '123-456-7890'
- '098-765-4321'
textarea:
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Negat esse eam, inquit, propter se expetendam. Primum Theophrasti, Strato, physicum se voluit; Id mihi magnum videtur. Itaque mihi non satis videmini considerare quod iter sit naturae quaeque progressio. Quare hoc videndum est, possitne nobis hoc ratio philosophorum dare. Est enim tanti philosophi tamque nobilis audacter sua decreta defendere.'
- 'Huius, Lyco, oratione locuples, rebus ipsis ielunior. Duo Reges: constructio interrete. Sed haec in pueris; Sed utrum hortandus es nobis, Luci, inquit, an etiam tua sponte propensus es? Sapiens autem semper beatus est et est aliquando in dolore; Immo videri fortasse. Paulum, cum regem Persem captum adduceret, eodem flumine invectio? Et ille ridens: Video, inquit, quid agas;'
- 'Quae cum dixisset, finem ille. Quamquam non negatis nos intellegere quid sit voluptas, sed quid ille dicat. Progredientibus autem aetatibus sensim tardeve potius quasi nosmet ipsos cognoscimus. Gloriosa ostentatio in constituendo summo bono. Qui-vere falsone, quaerere mittimus-dicitur oculis se privasse; Duarum enim vitarum nobis erunt instituta capienda. Comprehensum, quod cognitum non habet? Qui enim existimabit posse se miserum esse beatus non erit. Causa autem fuit huc veniendi ut quosdam hinc libros promerem. Nunc omni virtuti vitium contrario nomine opponitur.'
text_format:
- value: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Negat esse eam, inquit, propter se expetendam. Primum Theophrasti, Strato, physicum se voluit; Id mihi magnum videtur. Itaque mihi non satis videmini considerare quod iter sit naturae quaeque progressio. Quare hoc videndum est, possitne nobis hoc ratio philosophorum dare. Est enim tanti philosophi tamque nobilis audacter sua decreta defendere.</p>'
- value: '<p>Huius, Lyco, oratione locuples, rebus ipsis ielunior. Duo Reges: constructio interrete. Sed haec in pueris; Sed utrum hortandus es nobis, Luci, inquit, an etiam tua sponte propensus es? Sapiens autem semper beatus est et est aliquando in dolore; Immo videri fortasse. Paulum, cum regem Persem captum adduceret, eodem flumine invectio? Et ille ridens: Video, inquit, quid agas;</p>'
- value: '<p>Quae cum dixisset, finem ille. Quamquam non negatis nos intellegere quid sit voluptas, sed quid ille dicat. Progredientibus autem aetatibus sensim tardeve potius quasi nosmet ipsos cognoscimus. Gloriosa ostentatio in constituendo summo bono. Qui-vere falsone, quaerere mittimus-dicitur oculis se privasse; Duarum enim vitarum nobis erunt instituta capienda. Comprehensum, quod cognitum non habet? Qui enim existimabit posse se miserum esse beatus non erit. Causa autem fuit huc veniendi ut quosdam hinc libros promerem. Nunc omni virtuti vitium contrario nomine opponitur.</p>'
url:
- 'http://example.com'
- 'http://test.com'
webform_creditcard_number:
- '4111111111111111'
webform_email_confirm:
- 'example@example.com'
- 'test@test.com'
- 'random@random.com'
webform_email_multiple:
- 'example@example.com, test@test.com, random@random.com'
webform_location:
- value: 'The White House, 1600 Pennsylvania Ave NW, Washington, DC 20500, USA'
- value: 'London SW1A 1AA, United Kingdom'
- value: 'Moscow, Russia, 10307'
webform_time:
- '09:00'
- '17:00'
names: |
first_name:
- 'John'
- 'Paul'
- 'Ringo'
- 'George'
last_name:
- 'Lennon'
- 'McCartney'
- 'Starr'
- 'Harrison'
address:
- '10 Main Street'
- '11 Brook Alley Road. APT 1'
zip:
- '11111'
- '12345'
- '12345-6789'
phone:
- '123-456-7890'
- '098-765-4321'
city:
- 'Springfield'
- 'Pleasantville'
- 'Hill Valley'
url:
- 'http://example.com'
- 'http://test.com'
default:
- 'Loremipsum'
- 'Oratione'
- 'Dixisset'
ui:
video_display: dialog
details_save: true
dialog_disabled: false
offcanvas_disabled: false
html_editor_disabled: false
library:
cdn: false
langcode: en
third_party_settings: { }

View file

@ -0,0 +1,161 @@
langcode: en
status: open
dependencies:
enforced:
module:
- webform
open: null
close: null
uid: null
template: false
id: contact
title: Contact
description: 'Basic email contact webform.'
elements: |
name:
'#title': 'Your Name'
'#type': textfield
'#required': true
'#default_value': '[webform-authenticated-user:display-name]'
email:
'#title': 'Your Email'
'#type': email
'#required': true
'#default_value': '[webform-authenticated-user:mail]'
subject:
'#title': Subject
'#type': textfield
'#required': true
'#test': 'Testing contact webform from [site:name]'
message:
'#title': Message
'#type': textarea
'#required': true
'#test': 'Please ignore this email.'
css: ''
javascript: ''
settings:
page: true
page_submit_path: ''
page_confirm_path: ''
form_submit_label: 'Send message'
form_submit_once: false
form_submit_attributes: { }
form_exception_message: ''
form_closed_message: ''
form_previous_submissions: true
form_confidential: false
form_confidential_message: ''
form_prepopulate: false
form_prepopulate_source_entity: false
form_disable_autocomplete: false
form_novalidate: false
form_unsaved: false
form_disable_back: false
form_autofocus: false
form_details_toggle: false
wizard_progress_bar: true
wizard_progress_pages: false
wizard_progress_percentage: false
wizard_next_button_label: ''
wizard_next_button_attributes: { }
wizard_prev_button_label: ''
wizard_prev_button_attributes: { }
wizard_start_label: ''
wizard_complete: true
wizard_complete_label: ''
preview: 0
preview_next_button_label: ''
preview_next_button_attributes: { }
preview_prev_button_label: ''
preview_prev_button_attributes: { }
preview_message: ''
draft: false
draft_auto_save: false
draft_button_label: ''
draft_button_attributes: { }
draft_saved_message: ''
draft_loaded_message: ''
confirmation_type: url_message
confirmation_title: ''
confirmation_message: 'Your message has been sent.'
confirmation_url: '<front>'
confirmation_attributes: { }
confirmation_back: true
confirmation_back_label: ''
confirmation_back_attributes: { }
limit_total: null
limit_total_message: ''
limit_user: null
limit_user_message: ''
purge: none
purge_days: null
entity_limit_total: null
entity_limit_user: null
results_disabled: false
results_disabled_ignore: false
token_update: false
access:
create:
roles:
- anonymous
- authenticated
users: { }
view_any:
roles: { }
users: { }
update_any:
roles: { }
users: { }
delete_any:
roles: { }
users: { }
purge_any:
roles: { }
users: { }
view_own:
roles: { }
users: { }
update_own:
roles: { }
users: { }
delete_own:
roles: { }
users: { }
handlers:
email_confirmation:
id: email
label: 'Email confirmation'
handler_id: email_confirmation
status: true
weight: 1
settings:
to_mail: '[webform_submission:values:email:raw]'
cc_mail: ''
bcc_mail: ''
from_mail: default
from_name: default
subject: '[webform_submission:values:subject:value]'
body: '[webform_submission:values:message:value]'
excluded_elements: { }
html: true
attachments: false
debug: false
email_notification:
id: email
label: 'Email notification'
handler_id: email_notification
status: true
weight: 1
settings:
to_mail: default
cc_mail: ''
bcc_mail: ''
from_mail: '[webform_submission:values:email:raw]'
from_name: '[webform_submission:values:name:value]'
subject: '[webform_submission:values:subject:value]'
body: '[webform_submission:values:message:value]'
excluded_elements: { }
html: true
attachments: false
debug: false

View file

@ -0,0 +1,9 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: country_codes
label: 'Country codes'
options: ''

View file

@ -0,0 +1,9 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: country_names
label: 'Country names'
options: ''

View file

@ -0,0 +1,13 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: creditcard_codes
label: 'Credit card codes'
options: |
VI: 'Visa'
MC: 'Mastercard'
AE: 'American Express'
DC: 'Discover'

View file

@ -0,0 +1,16 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: days
label: Days
options: |
Sunday: Sunday
Monday: Monday
Tuesday: Tuesday
Wednesday: Wednesday
Thursday: Thursday
Friday: Friday
Saturday: Saturday

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: education
label: Education
options: |
High School: High School
Associate Degree: Associate Degree
Associate Degree: Associate Degree
Graduate or Professional Degree: Graduate or Professional Degree
Some College: Some College

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: employment_status
label: 'Employment status'
options: |
'Full Time': 'Full Time'
'Part Time': 'Part Time'
'Military': 'Military'
Unemployed: Unemployed
Retired: Retired

View file

@ -0,0 +1,17 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: ethnicity
label: Ethnicity
options: |
Caucasian: Caucasian
'Latino/Hispanic': 'Latino/Hispanic'
'Middle Eastern': 'Middle Eastern'
African: African
Caribbean: Caribbean
'South Asian': 'South Asian'
'East Asian': 'East Asian'
Mixed: Mixed

View file

@ -0,0 +1,12 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: gender
label: Gender
options: |
Male: Male
Female: Female
Transgender: Transgender

View file

@ -0,0 +1,48 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: industry
label: Industry
options: |
Accounting/Finance: Accounting/Finance
Advertising/Public Relations: Advertising/Public Relations
Aerospace/Aviation: Aerospace/Aviation
Arts/Entertainment/Publishing: Arts/Entertainment/Publishing
Automotive: Automotive
Banking/Mortgage: Banking/Mortgage
Business Development: Business Development
Business Opportunity: Business Opportunity
Clerical/Administrative: Clerical/Administrative
Construction/Facilities: Construction/Facilities
Consumer Goods: Consumer Goods
Customer Service: Customer Service
Education/Training: Education/Training
Energy/Utilities: Energy/Utilities
Engineering: Engineering
Government/Military: Government/Military
Healthcare: Healthcare
Hospitality/Travel: Hospitality/Travel
Human Resources: Human Resources
Installation/Maintenance: Installation/Maintenance
Insurance: Insurance
Internet: Internet
Law Enforcement/Security: Law Enforcement/Security
Legal: Legal
Management/Executive: Management/Executive
Manufacturing/Operations: Manufacturing/Operations
Marketing: Marketing
Non-Profit/Volunteer: Non-Profit/Volunteer
Pharmaceutical/Biotech: Pharmaceutical/Biotech
Professional Services: Professional Services
Real Estate: Real Estate
Restaurant/Food Service: Restaurant/Food Service
Retail: Retail
Sales: Sales
Science/Research: Science/Research
Skilled Labor: Skilled Labor
Technology: Technology
Telecommunications: Telecommunications
Transportation/Logistics: Transportation/Logistics

View file

@ -0,0 +1,9 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: languages
label: Languages
options: ''

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_agreement
label: 'Likert: Agreement'
options: |
1: Much Worse
2: Somewhat Worse
3: About the Same
4: Somewhat Better
5: Much Better

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_comparison
label: 'Likert: Comparison'
options: |
1: Strongly Disagree
2: Disagree
3: Neutral
4: Agree
5: Strongly Agree

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_importance
label: 'Likert: Importance'
options: |
1: Not at all Important
2: Somewhat Important
3: Neutral
4: Important
5: Very Important

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_quality
label: 'Likert: Quality'
options: |
1: Poor
2: Fair
3: Good
4: Very good
5: Excellent

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_satisfaction
label: 'Likert: Satisfaction'
options: |
1: Very Unsatisfied
2: Unsatisfied
3: Neutral
4: Satisfied
5: Very Satisfied

View file

@ -0,0 +1,19 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_ten_scale
label: 'Likert: Ten Scale'
options: |
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
10: 10

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: likert_would_you
label: 'Likert: Would You'
options: |
1: Definitely Not
2: Probably Not
3: Not Sure
4: Probably
5: Definitely

View file

@ -0,0 +1,13 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: marital_status
label: 'Marital status'
options: |
Single: Single
Married: Married
Divorced: Divorced
Widowed: Widowed

View file

@ -0,0 +1,21 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: months
label: Months
options: |
January: January
February: February
March: March
April: April
May: May
June: June
July: July
August: August
September: September
October: October
November: November
December: December

View file

@ -0,0 +1,12 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: phone_types
label: 'Phone type'
options: |
Home: Home
Office: Office
Cell: Cell

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: relationship
label: Relationship
options: |
Parent: Parent
'Significant Other': 'Significant Other'
Sibling: Sibling
Child: Child
Friend: Friend

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: size
label: Size
options: |
Extra Small: Extra Small
Small: Small
Medium: Medium
Large: Large
Extra Large: Extra Large

View file

@ -0,0 +1,61 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: state_codes
label: 'State codes'
options: |
AL: Alabama
AK: Alaska
AZ: Arizona
AR: Arkansas
CA: California
CO: Colorado
CT: Connecticut
DE: Delaware
DC: 'District of Columbia'
FL: Florida
GA: Georgia
GU: Guam
HI: Hawaii
ID: Idaho
IL: Illinois
IN: Indiana
IA: Iowa
KS: Kansas
KY: Kentucky
LA: Louisiana
ME: Maine
MD: Maryland
MA: Massachusetts
MI: Michigan
MN: Minnesota
MS: Mississippi
MO: Missouri
MT: Montana
NE: Nebraska
NV: Nevada
NH: 'New Hampshire'
NJ: 'New Jersey'
NM: 'New Mexico'
NY: 'New York'
NC: 'North Carolina'
ND: 'North Dakota'
OH: Ohio
OK: Oklahoma
OR: Oregon
PA: Pennsylvania
RI: 'Rhode Island'
SC: 'South Carolina'
SD: 'South Dakota'
TN: Tennessee
TX: Texas
UT: Utah
VT: Vermont
VA: Virginia
WA: Washington
WV: 'West Virginia'
WI: Wisconsin
WY: Wyoming

View file

@ -0,0 +1,60 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: state_names
label: 'State names'
options: |
Alabama: Alabama
Alaska: Alaska
Arizona: Arizona
Arkansas: Arkansas
California: California
Colorado: Colorado
Connecticut: Connecticut
Delaware: Delaware
'District of Columbia': 'District of Columbia'
Florida: Florida
Georgia: Georgia
Hawaii: Hawaii
Idaho: Idaho
Illinois: Illinois
Indiana: Indiana
Iowa: Iowa
Kansas: Kansas
Kentucky: Kentucky
Louisiana: Louisiana
Maine: Maine
Maryland: Maryland
Massachusetts: Massachusetts
Michigan: Michigan
Minnesota: Minnesota
Mississippi: Mississippi
Missouri: Missouri
Montana: Montana
Nebraska: Nebraska
Nevada: Nevada
'New Hampshire': 'New Hampshire'
'New Jersey': 'New Jersey'
'New Mexico': 'New Mexico'
'New York': 'New York'
'North Carolina': 'North Carolina'
'North Dakota': 'North Dakota'
Ohio: Ohio
Oklahoma: Oklahoma
Oregon: Oregon
Pennsylvania: Pennsylvania
'Rhode Island': 'Rhode Island'
'South Carolina': 'South Carolina'
'South Dakota': 'South Dakota'
Tennessee: Tennessee
Texas: Texas
Utah: Utah
Vermont: Vermont
Virginia: Virginia
Washington: Washington
'West Virginia': 'West Virginia'
Wisconsin: Wisconsin
Wyoming: Wyoming

View file

@ -0,0 +1,71 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: state_province_codes
label: 'State/Province codes'
options: |
AL: Alabama
AK: Alaska
AS: 'American Samoa'
AZ: Arizona
AR: Arkansas
AE: 'Armed Forces (Canada, Europe, Africa, or Middle East'
AA: 'Armed Forces Americas'
AP: 'Armed Forces Pacific'
CA: California
CO: Colorado
CT: Connecticut
DE: Delaware
DC: 'District of Columbia'
FM: 'Federate States of Micronesia'
FL: Florida
GA: Georgia
GU: Guam
HI: Hawaii
ID: Idaho
IL: Illinois
IN: Indiana
IA: Iowa
KS: Kansas
KY: Kentucky
LA: Louisiana
ME: Maine
MH: 'Marshall Islands'
MD: Maryland
MA: Massachusetts
MI: Michigan
MN: Minnesota
MS: Mississippi
MO: Missouri
MT: Montana
NE: Nebraska
NV: Nevada
NH: 'New Hampshire'
NJ: 'New Jersey'
NM: 'New Mexico'
NY: 'New York'
NC: 'North Carolina'
ND: 'North Dakota'
MP: 'Northern Mariana Islands'
OH: Ohio
OK: Oklahoma
OR: Oregon
PW: Palau
PA: Pennsylvania
PR: 'Puerto Rico'
RI: 'Rhode Island'
SC: 'South Carolina'
SD: 'South Dakota'
TN: Tennessee
TX: Texas
UT: Utah
VT: Vermont
VI: 'Virgin Islands'
VA: Virginia
WA: Washington
WV: 'West Virginia'
WI: Wisconsin
WY: Wyoming

View file

@ -0,0 +1,71 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: state_province_names
label: 'State/Province names'
options: |
Alabama: Alabama
Alaska: Alaska
'American Samoa': 'American Samoa'
Arizona: Arizona
Arkansas: Arkansas
'Armed Forces (Canada, Europe, Africa, or Middle East': 'Armed Forces (Canada, Europe, Africa, or Middle East'
'Armed Forces Americas': 'Armed Forces Americas'
'Armed Forces Pacific': 'Armed Forces Pacific'
California: California
Colorado: Colorado
Connecticut: Connecticut
Delaware: Delaware
'District of Columbia': 'District of Columbia'
'Federate States of Micronesia': 'Federate States of Micronesia'
Florida: Florida
Georgia: Georgia
Guam: Guam
Hawaii: Hawaii
Idaho: Idaho
Illinois: Illinois
Indiana: Indiana
Iowa: Iowa
Kansas: Kansas
Kentucky: Kentucky
Louisiana: Louisiana
Maine: Maine
'Marshall Islands': 'Marshall Islands'
Maryland: Maryland
Massachusetts: Massachusetts
Michigan: Michigan
Minnesota: Minnesota
Mississippi: Mississippi
Missouri: Missouri
Montana: Montana
Nebraska: Nebraska
Nevada: Nevada
'New Hampshire': 'New Hampshire'
'New Jersey': 'New Jersey'
'New Mexico': 'New Mexico'
'New York': 'New York'
'North Carolina': 'North Carolina'
'North Dakota': 'North Dakota'
'Northern Mariana Islands': 'Northern Mariana Islands'
Ohio: Ohio
Oklahoma: Oklahoma
Oregon: Oregon
Palau: Palau
Pennsylvania: Pennsylvania
'Puerto Rico': 'Puerto Rico'
'Rhode Island': 'Rhode Island'
'South Carolina': 'South Carolina'
'South Dakota': 'South Dakota'
Tennessee: Tennessee
Texas: Texas
Utah: Utah
Vermont: Vermont
'Virgin Islands': 'Virgin Islands'
Virginia: Virginia
Washington: Washington
'West Virginia': 'West Virginia'
Wisconsin: Wisconsin
Wyoming: Wyoming

View file

@ -0,0 +1,9 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: time_zones
label: 'Time zones'
options: ''

View file

@ -0,0 +1,14 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: titles
label: Titles
options: |
Miss: Miss
Ms: Ms
Mr: Mr
Mrs: Mrs
Dr: Dr

View file

@ -0,0 +1,11 @@
langcode: en
status: true
dependencies:
enforced:
module:
- webform
id: yes_no
label: Yes/No
options: |
Yes: Yes
No: No

View file

@ -0,0 +1,21 @@
webform.admin_settings.third_party.honeypot:
type: mapping
label: 'Webform test third party settings'
mapping:
honeypot:
type: boolean
label: 'Protect all webforms with Honeypot'
time_restriction:
type: boolean
label: 'Add time limit to all webforms'
webform.settings.third_party.honeypot:
type: mapping
label: 'Webform test third party settings'
mapping:
honeypot:
type: boolean
label: 'Protect all webforms with Honeypot'
time_restriction:
type: boolean
label: 'Add time limit to all webforms'

View file

@ -0,0 +1,860 @@
# Schema for the configuration files of the Webform module.
webform.settings:
type: config_object
label: 'Webform settings'
mapping:
settings:
type: mapping
label: 'Webform default settings'
mapping:
default_page_base_path:
type: string
label: 'Default base path'
default_form_submit_label:
type: label
label: 'Default webform submit text'
default_form_submit_once:
type: boolean
label: 'Prevent duplicate submissions'
default_form_closed_message:
type: text
label: 'Default webform closed message'
default_form_exception_message:
type: text
label: 'Default webform exception message'
default_form_confidential_message:
type: text
label: 'Default webform confidential message'
default_form_novalidate:
type: boolean
label: 'Disable client-side validation'
default_form_unsaved:
type: boolean
label: 'Warn users about unsaved changes'
default_form_disable_back:
type: boolean
label: 'Disable back button'
default_form_details_toggle:
type: boolean
label: 'Display collapse/expand all details link'
default_wizard_prev_button_label:
type: label
label: 'Default wizard previous page button label'
default_wizard_next_button_label:
type: label
label: 'Default wizard next page button label'
default_wizard_start_label:
type: label
label: 'Default wizard start label'
default_wizard_complete_label:
type: label
label: 'Default wizard complete label'
default_preview_next_button_label:
type: label
label: 'Default preview button label'
default_preview_prev_button_label:
type: label
label: 'Default preview previous page button label'
default_preview_message:
type: text
label: 'Default preview message'
default_draft_button_label:
type: label
label: 'Default draft button label'
default_draft_saved_message:
type: text
label: 'Default draft save message'
default_draft_loaded_message:
type: text
label: 'Default draft load message'
default_confirmation_message:
type: text
label: 'Default confirmation message'
default_confirmation_back_label:
type: text
label: 'Default confirmation back label'
default_limit_total_message:
type: text
label: 'Default limit total message'
default_limit_user_message:
type: text
label: 'Default limit user message'
form_classes:
type: string
label: 'Webform CSS classes'
button_classes:
type: string
label: 'Button CSS classes'
confirmation_classes:
type: string
label: 'Confirmation CSS classes'
confirmation_back_classes:
type: string
label: 'Confirmation back link CSS classes'
assets:
type: mapping
label: 'Global Assets (CSS/JavaScript)'
mapping:
css:
type: string
label: 'CSS (Cascading Style Sheets)'
javascript:
type: string
label: 'JavaScript'
elements:
type: mapping
label: 'Elements default settings'
mapping:
allowed_tags:
type: string
label: 'Allowed tags'
wrapper_classes:
type: string
label: 'Wrapper CSS classes'
classes:
type: string
label: 'Element CSS classes'
default_description_display:
type: string
label: 'Default title display'
default_google_maps_api_key:
type: string
label: 'Default Google Maps API key'
excluded_types:
type: ignore
label: 'Excluded types'
file:
type: mapping
label: 'File upload default settings'
mapping:
file_public:
type: boolean
label: 'Allow files to be uploaded to public file system.'
default_max_filesize:
type: string
label: 'Default maximum upload size'
default_managed_file_extensions:
type: string
label: 'Default allowed managed file extensions'
default_image_file_extensions:
type: string
label: 'Default allowed image file extensions'
default_video_file_extensions:
type: string
label: 'Default allowed video file extensions'
default_audio_file_extensions:
type: string
label: 'Default allowed audio file extensions'
default_document_file_extensions:
type: string
label: 'Default allowed document file extensions'
format:
type: ignore
label: 'Format default settings'
mail:
type: mapping
label: 'Email default settings'
mapping:
default_from_mail:
type: email
label: 'Default email from address'
default_from_name:
type: label
label: 'Default email from name'
default_subject:
type: label
label: 'Default email subject'
default_body_text:
type: text
label: 'Default email body (Plain text)'
default_body_html:
type: text
label: 'Default email body (HTML)'
export:
type: mapping
label: 'Export default settings'
mapping:
exporter:
type: string
label: 'Results exporter'
delimiter:
type: string
label: 'Delimiter text format'
multiple_delimiter:
type: string
label: 'Element multiple values delimiter'
excel:
type: boolean
label: 'Open HTML table in Excel'
file_name:
type: string
label: 'File name'
header_format:
type: string
label: 'Column header format'
header_prefix:
type: boolean
label: 'Column header prefix'
header_prefix_key_delimiter:
type: string
label: 'Column header prefix key delimiter'
header_prefix_label_delimiter:
type: string
label: 'Column header prefix label delimiter'
entity_reference_format:
type: string
label: 'Options format'
options_format:
type: string
label: 'Options item format'
options_item_format:
type: string
label: 'Entity reference format'
likert_answers_format:
type: string
label: 'Likert answers format'
signature_format:
type: string
label: 'Signature format'
composite_element_item_format:
type: string
label: 'Composite element item format'
batch:
type: mapping
label: 'Batch settings'
mapping:
default_batch_export_size:
type: integer
label: 'Batch export size'
default_batch_update_size:
type: integer
label: 'Batch update size'
default_batch_delete_size:
type: integer
label: 'Batch delete size'
purge_settings:
type: mapping
label: 'Automated purging settings'
mapping:
cron_size:
type: integer
label: 'Amount of submissions to process'
test:
type: mapping
label: 'Test settings'
mapping:
types:
type: text
label: 'Test types'
names:
type: text
label: 'Test names'
ui:
type: mapping
label: 'User interface settings'
mapping:
video_display:
type: string
label: 'Video display'
dialog_disabled:
type: boolean
label: 'Disable dialogs'
offcanvas_disabled:
type: boolean
label: 'Disable system tray'
html_editor_disabled:
type: boolean
label: 'Disable HTML editor'
details_save:
type: boolean
label: 'Save details open/close state'
library:
type: mapping
label: 'Library settings'
mapping:
cdn:
type: boolean
label: 'Use CDN'
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: webform.admin_settings.third_party.[%key]
webform.webform.*:
type: config_entity
label: 'Webforms'
mapping:
status:
type: string
label: 'Status'
open:
type: string
label: 'Open date/time'
close:
type: string
label: 'Close date/time'
uid:
type: integer
label: 'Author'
template:
type: boolean
label: 'Template'
id:
type: string
label: 'Machine name'
title:
type: label
label: 'Title'
description:
type: label
label: 'Administrative description'
elements:
type: text
label: 'Elements (YAML)'
css:
type: string
label: 'CSS (Cascading Style Sheets)'
javascript:
type: string
label: 'JavaScript'
settings:
type: mapping
label: 'Settings'
mapping:
page:
type: boolean
label: 'Enable page'
page_submit_path:
type: string
label: 'Page submit URL alias'
page_confirm_path:
type: string
label: 'Page confirm URL alias'
form_submit_label:
type: label
label: 'Webform submit text'
form_submit_once:
type: boolean
label: 'Prevent duplicate submissions'
form_submit_attributes:
type: ignore
label: 'Webform submit attributes'
form_closed_message:
type: text
label: 'Webform closed message'
form_exception_message:
type: text
label: 'Webform exception message'
form_previous_submissions:
type: boolean
label: 'Webform previous submissions notification'
form_confidential:
type: boolean
label: 'Webform confidential'
form_confidential_message:
type: text
label: 'Webform confidential message'
form_prepopulate:
type: boolean
label: 'Webform prepopulate elements'
form_prepopulate_source_entity:
type: boolean
label: 'Webform prepopulate source entity'
form_unsaved:
type: boolean
label: 'Warn users about unsaved changes'
form_disable_back:
type: boolean
label: 'Disable back button'
form_disable_autocomplete:
type: boolean
label: 'Disable autocompletion'
form_novalidate:
type: boolean
label: 'Disable client-side validation'
form_autofocus:
type: boolean
label: 'Autofocus'
form_details_toggle:
type: boolean
label: 'Display collapse/expand all details link'
wizard_progress_bar:
type: boolean
label: 'Show wizard progress bar'
wizard_progress_pages:
type: boolean
label: 'Show wizard progress pages'
wizard_progress_percentage:
type: boolean
label: 'Show wizard progress pages'
wizard_start_label:
type: label
label: 'Wizard start label'
wizard_start_attributes:
type: ignore
label: 'Wizard start attributes'
wizard_complete:
type: boolean
label: 'Include confirmation page in progress'
wizard_complete_label:
type: label
label: 'Wizard complete label'
wizard_prev_button_label:
type: label
label: 'Wizard previous page button label'
wizard_prev_button_attributes:
type: ignore
label: 'Wizard previous page button attributes'
wizard_next_button_label:
type: label
label: 'Wizard next page button label'
wizard_next_button_attributes:
type: ignore
label: 'Wizard next page button attributes'
preview:
type: integer
label: 'Enable preview page'
preview_next_button_label:
type: label
label: 'Preview button label'
preview_next_button_attributes:
type: ignore
label: 'Preview button attributes'
preview_prev_button_label:
type: label
label: 'Previous page button label'
preview_prev_button_attributes:
type: ignore
label: 'Previous page button attributes'
preview_message:
type: text
label: 'Preview message'
draft:
type: boolean
label: 'Allow your users to save and finish the webform later.'
draft_auto_save:
type: boolean
label: 'Automatically save as draft when previewing and when there are validation errors.'
draft_button_label:
type: label
label: 'Draft button label'
draft_button_attributes:
type: ignore
label: 'Draft button attributes'
draft_saved_message:
type: text
label: 'Draft saved message'
draft_loaded_message:
type: text
label: 'Draft loaded message'
confirmation_type:
type: string
label: 'Confirmation type'
confirmation_url:
type: string
label: 'Confirmation URL'
confirmation_title:
type: text
label: 'Confirmation title'
confirmation_message:
type: text
label: 'Confirmation message'
confirmation_attributes:
type: ignore
label: 'Confirmation attributes'
confirmation_back:
type: boolean
label: 'Display back to webform link.'
confirmation_back_label:
type: text
label: 'Confirmation back link label'
confirmation_back_attributes:
type: ignore
label: 'Confirmation back link attributes'
limit_total:
type: integer
label: 'Limit total submissions'
limit_total_message:
type: text
label: 'Limit total message'
limit_user:
type: integer
label: 'Limit user submissions'
limit_user_message:
type: text
label: 'Limit user message'
purge:
type: string
label: 'Default purging'
purge_days:
type: integer
label: 'Default days to retain submissions'
entity_limit_total:
type: integer
label: 'Entity limit total submissions'
entity_limit_user:
type: integer
label: 'Entity limit user submissions'
results_disabled:
type: boolean
label: 'Results disabled'
results_disabled_ignore:
type: boolean
label: 'Ignore disabled results warning'
token_update:
type: boolean
label: 'Allow updates using token'
access:
type: mapping
label: 'Access'
mapping:
create:
type: mapping
label: 'Create webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
view_any:
type: mapping
label: 'View any webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
update_any:
type: mapping
label: 'Update any webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
delete_any:
type: mapping
label: 'Delete any webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
purge_any:
type: mapping
label: 'Purge any webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
view_own:
type: mapping
label: 'View own webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
update_own:
type: mapping
label: 'Update own webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
delete_own:
type: mapping
label: 'Delete own webform submissions'
mapping:
roles:
type: sequence
label: 'Roles'
sequence:
type: string
label: 'Role'
users:
type: sequence
label: 'Users'
sequence:
type: integer
label: 'User IDs'
handlers:
type: sequence
label: 'Webform handlers'
sequence:
type: mapping
mapping:
id:
type: string
handler_id:
type: string
label:
type: label
status:
type: boolean
weight:
type: integer
settings:
type: webform.handler.[%parent.id]
third_party_settings:
type: sequence
label: 'Third party settings'
sequence:
type: webform.settings.third_party.[%key]
webform.handler.*:
type: mapping
label: 'Handler settings'
webform.handler.email:
type: mapping
label: 'Email'
mapping:
to_mail:
label: 'Email to address'
type: email
bcc_mail:
label: 'Email Bcc address'
type: email
cc_mail:
label: 'Email Cc address'
type: email
from_mail:
label: 'Email from address'
type: email
from_name:
label: 'Email from name'
type: label
subject:
label: 'Email subject'
type: label
body:
label: 'Email body'
type: text
excluded_elements:
type: sequence
label: 'Exclude elements'
sequence:
type: string
label: 'Element name'
html:
type: boolean
label: 'HTML'
attachments:
type: boolean
label: 'Attachments'
debug:
type: boolean
label: 'Enable debugging'
webform.handler.remote_post:
type: mapping
label: 'Remote Post'
mapping:
type:
label: 'Type'
type: string
insert_url:
label: 'Insert URL'
type: uri
update_url:
label: 'Update URL'
type: uri
delete_url:
label: 'Delete URL'
type: uri
excluded_data:
type: sequence
label: 'Excluded data'
sequence:
type: string
label: 'Data name'
custom_data:
label: 'Custom data'
type: string
insert_custom_data:
label: 'Insert custom data'
type: string
update_custom_data:
label: 'Update custom data'
type: string
delete_custom_data:
label: 'Delete custom data'
type: string
debug:
type: boolean
label: 'Enable debugging'
webform.exporter.*:
type: mapping
label: 'Exporter settings'
webform.exporter.delimited_text:
type: mapping
label: 'Delimiter'
mapping:
delimiter:
type: string
label: 'Delimiter'
webform.webform_options.*:
type: config_entity
label: 'Options'
mapping:
id:
type: string
label: 'Machine name'
label:
type: label
label: 'Label'
options:
type: text
label: 'Options (YAML)'
block.settings.webform_block:
type: block_settings
label: 'Webforms block'
mapping:
webform_id:
type: text
label: 'Webforms'
default_data:
type: text
label: 'Default webform submission data'
# Schema for the configuration of the webform field type.
field.storage_settings.webform:
type: mapping
label: 'Webform field storage settings'
mapping:
target_type:
type: string
label: 'Type of item to reference'
base_webform_field_field_settings:
type: mapping
mapping:
handler:
type: string
label: 'Reference method'
handler_settings:
type: entity_reference_selection.[%parent.handler]
label: 'Entity reference selection settings'
field.field_settings.webform:
type: base_webform_field_field_settings
label: 'Webform settings'
mapping:
default_data:
type: string
label: 'Default webform submission data'
status:
type: boolean
label: 'Status of the webform'
field.widget.settings.webform_entity_reference_autocomplete:
type: mapping
label: 'Webform autocomplete display format settings'
mapping:
match_operator:
type: string
label: 'Autocomplete matching'
size:
type: integer
label: 'Size of textfield'
placeholder:
type: label
label: 'Placeholder'
field.formatter.settings.webform_entity_reference_entity_view:
type: mapping
label: 'Display the referenced webform with default submission data.'
field.formatter.settings.webform_entity_reference_link:
type: mapping
label: 'Display the referenced webform as a link.'
mapping:
label:
type: label
label: 'Link label to the referenced webform'
action.configuration.webform_submission_delete_action:
type: action_configuration_default
label: 'Delete submission configuration'
action.configuration.webform_submission_make_sticky_action:
type: action_configuration_default
label: 'Star/Flag selected submission configuration'
action.configuration.webform_submission_make_unsticky_action:
type: action_configuration_default
label: 'Unstar/Unflag selected submission configuration'
condition.plugin.webform:
type: condition.plugin
mapping:
webforms:
type: sequence
sequence:
type: string

View file

@ -0,0 +1,3 @@
views.field.webform_submission_bulk_form:
type: views_field_bulk_form
label: 'Webform submission bulk form'

View file

@ -0,0 +1,173 @@
/**
* @file
* Admin styles
*/
/**
* Hide throbber which causes layout issue in dropbutton
*/
.dropbutton-multiple .ajax-progress-throbber {
display: none;
}
/**
* Webform setting button displays a gear icon.
* @see /admin/structure/webform/manage/contact/results/table
*/
.button.button-webform-setting {
margin: 0 0 1em 0;
}
.button.button-webform-setting:before {
content: '⚙';
font-size: 1.2em;
}
/**
* Add light gray background to Add-on details widget.
* @see /admin/structure/webform/addons
*/
.webform-addons details {
background-color: #f8f8f8;
}
/**
* Filter webform and submissions.
* @see /admin/structure/webform
* @see /admin/structure/webform/templates
*/
.webform-filter-form .form-submit {
margin-left: 0;
margin-right: 5px;
}
.webform-filter-form .form-item {
margin-right: 5px;
}
@media screen and (max-width: 600px) {
.webform-filter-form .form-item {
display: block;
margin-right: 0;
}
}
/**
* Results table.
* @see /admin/structure/webform/results/manage
* @see /admin/structure/webform/manage/contact/results/submissions
* @see /admin/structure/webform/manage/contact/results/table
*/
.webform-results__table th,
.webform-results__table td {
max-width: 400px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* Make sure 'Operations' is never cut-off */
.webform-results__table td:last-child {
overflow: visible;
max-width: inherit;
white-space: normal;
}
th.webform-results__icon,
td.webform-results__icon {
padding-left: 0;
padding-right: 0;
}
/* Hide throbber, which breaks icon alignment */
.webform-results__icon .ajax-progress-throbber,
a.webform-results__custom + .ajax-progress-throbber {
display: none;
}
/* Entire row is clickable. @see Drupal.behaviors.webformTableRowHref */
.webform-results__table tbody tr {
cursor: pointer;
cursor: hand;
}
/**
* Results custom(ize) dialog.
*/
.webform-results__custom .tabledrag-changed-warning,
.webform-results__custom .tabledrag-changed /* Hide table drag warnings. */ {
display: none !important; /* Must use !important because .tabledrag-changed 'display' is set via JavaScript */
}
/**
* Results icons (sticky & notes)
*/
.webform-icon {
display: inline-block;
height: 16px;
width: 16px;
text-align: center;
background-color: transparent;
background-repeat: no-repeat;
background-position: center center;
background-size: 100% auto;
vertical-align: -2px;
}
.webform-icon-notes--on {
background-image: url(../images/icons/notes-on.svg);
}
.webform-icon-notes--off {
background-image: url(../images/icons/notes-off.svg);
}
.webform-icon-notes--link {
background-image: url(../images/icons/notes-link.svg);
}
a:hover .webform-icon-notes--on,
a:focus .webform-icon-notes--on,
a:hover .webform-icon-notes--off,
a:focus .webform-icon-notes--off {
background-image: url(../images/icons/notes-link.svg);
}
.webform-icon-sticky {
background: transparent url(../images/icons/sticky.svg) no-repeat left top;
display: inline-block;
background-size: 64px 16px;
}
.webform-icon-sticky--off:hover,
.webform-icon-sticky--off:focus {
background-position: -16px top;
}
.webform-icon-sticky--on {
background-position: -32px top;
}
.webform-icon-sticky--on:focus,
.webform-icon-sticky--on:hover {
background-position: -48px top;
}
.webform-icon-sticky--link {
background: transparent url(../images/icons/sticky-link.svg) no-repeat left top;
}
/**
* Submission view table.
* @see /admin/structure/webform/manage/{webform_id}/submission/{webform_submission_id}/table
*/
.webform-submission__table th {
width: 33%;
min-width: 100px;
}
.webform-submission__table td {
width: 66%;
}
.webform-horizontal-rule {
margin: .5em 0;
}

View file

@ -0,0 +1,12 @@
/**
* @file
* Translation styles.
*/
/**
* Remove margin in left column in translate tab to ensure form items line up.
* @see /admin/structure/webform/manage/contact/translate/es/add
*/
.webform-translation-source .form-item {
margin: 0;
}

View file

@ -0,0 +1,8 @@
/**
* @file
* This an empty placeholder file that is replaced with custom CSS.
*
* @see webform_css_alter()
* @see _webform_asset_alter()
* @see \Drupal\webform\WebformSubmissionForm::form
*/

View file

@ -0,0 +1,11 @@
/**
* @file
* Confirmation styles.
*
* @see /webform/contact/confirmation
*/
.webform-confirmation__message,
.webform-confirmation__back {
margin: 0 0 1em 0;
}

View file

@ -0,0 +1,27 @@
/**
* @file
* CodeMirror styles.
*
* @see /webform/test_element_codemirror/test
*/
/* Clean up CodeMirror editor */
form .CodeMirror {
border: 1px solid #ccc;
font-size: 13px;
height: auto;
}
form .CodeMirror-scroll {
overflow-y: hidden;
overflow-x: auto;
}
/* Clean up CodeMirror viewer */
pre.webform-codemirror-runmode {
border: 1px solid #ccc;
font-size: 13px;
overflow: auto;
padding: 3px;
margin: 0;
}

View file

@ -0,0 +1,44 @@
/**
* @file
* Element color styles
*
* @see \Drupal\webform\Plugin\WebformElement\Color
* @see webform-element-color-value-swatch.html.twig
* @see http://stackoverflow.com/questions/11167281/webkit-css-to-control-the-box-around-the-color-in-an-elementtype-color
*/
.webform-submission-form input.form-color {
margin: inherit;
padding: 0;
border: 1px solid #ccc;
}
.webform-submission-form input.form-color::-webkit-color-swatch-wrapper {
padding: 0;
}
.webform-submission-form input.form-color::-webkit-color-swatch {
border: none;
}
input.form-color.form-color-small {
width: 16px;
height: 16px;
font-size: smaller;
}
input.form-color.form-color-medium {
width: 24px;
height: 24px;
}
input.form-color.form-color-large {
width: 36px;
height: 36px;
}
input.form-color.form-color-output {
width: 6em;
padding: 0 .5em;
border-left: 0;
}

View file

@ -0,0 +1,11 @@
/**
* @file
* Composite element styles
*
* @see /webform/example_elements_composite
*/
/* Remove extra margin are composite element which already contain form elements with margins */
fieldset.form-composite {
margin: 0;
}

View file

@ -0,0 +1,22 @@
/**
* @file
* Composite telephone element styles.
*/
.webform-telephone:after {
content: "";
display: table;
clear: both;
}
.webform-telephone .form-item,
.webform-telephone .form-item label {
float: left;
margin: 0 10px 0 0;
vertical-align: middle;
}
.webform-telephone .form-item label {
line-height: 2em;
height: 2em;
}

View file

@ -0,0 +1,21 @@
/**
* @file
* Element details toggle all styles.
*
* @see /webform/test_form_details_toggle
*/
.webform-details-toggle-state-wrapper {
text-align: right; /* LTR */
}
[dir="rtl"] .webform-details-toggle-state-wrapper {
text-align: left;
}
.webform-details-toggle-state-wrapper {
margin-top: 1em;
}
.webform-details-toggle-state-wrapper + details {
margin-top: 0;
}

View file

@ -0,0 +1,167 @@
/**
* @file
* Flexbox styles.
*
* @see /webform/example_layout_flexbox
* @see /webform/test_element_flexbox_flex
*/
@media (min-width: 768px) {
.webform-flexbox {
display: -webkit-flex;
display: flex;
margin: 1em -.5em;
}
.webform-flexbox .webform-flexbox {
margin: 1em 0;
}
.webform-flexbox--flex-start {
-webkit-align-items: flex-start;
align-items: flex-start;
}
.webform-flexbox--flex-end {
-webkit-align-items: flex-end;
align-items: flex-end;
}
.webform-flexbox--center {
-webkit-align-items: center;
align-items: center;
}
.webform-flex {
min-width: 0;
}
.webform-flex--container {
margin: 0 .5em;
}
.webform-flex--container > .form-item {
margin: 0;
}
.webform-flex--container > .form-item > input,
.webform-flex--container > .form-item > select {
width: 100%;
}
.container-inline .webform-flex--container > .form-item > input,
.container-inline .webform-flex--container > .form-item > select {
width: inherit;
}
.webform-flex--container > .webform-has-field-prefix > input,
.webform-flex--container > .webform-has-field-suffix > input,
.webform-flex--container > .webform-has-field-prefix > select,
.webform-flex--container > .webform-has-field-suffix > select {
width: 85%;
}
.webform-flex--container > .webform-has-field-prefix.webform-flex.webform-has-field-suffix > input,
.webform-flex--container > .webform-has-field-prefix.webform-flex.webform-has-field-suffix > select {
width: 70%;
}
.webform-flex--1 {
-webkit-flex: 1;
flex: 1;
}
.webform-flex--2 {
-webkit-flex: 2;
flex: 2;
}
.webform-flex--3 {
-webkit-flex: 3;
flex: 3;
}
.webform-flex--4 {
-webkit-flex: 4;
flex: 4;
}
.webform-flex--5 {
-webkit-flex: 5;
flex: 5;
}
.webform-flex--6 {
-webkit-flex: 6;
flex: 6;
}
.webform-flex--7 {
-webkit-flex: 7;
flex: 7;
}
.webform-flex--8 {
-webkit-flex: 8;
flex: 8;
}
.webform-flex--9 {
-webkit-flex: 9;
flex: 9;
}
.webform-flex--10 {
-webkit-flex: 10;
flex: 10;
}
.webform-flex--11 {
-webkit-flex: 11;
flex: 11;
}
.webform-flex--12 {
-webkit-flex: 12;
flex: 12;
}
/**
* Select other.
*/
.webform-flex--container > .form-type-webform-select-other select {
width: 100%;
}
.webform-flex--container > .form-type-webform-select-other .form-item {
margin: 0;
}
.webform-flex--container > .form-type-webform-select-other .form-item + .form-item {
margin-top: .5em;
}
/**
* Range.
*/
.webform-flex--container > .form-type-range-output > .form-range-output {
width: 66%;
}
/**
* Composite.
*/
.form-composite > .webform-flexbox {
margin: 1em -.5em;
}
/**
* Radios/checkboxes.
*/
.form-type-checkbox,
.form-type-radio {
white-space: nowrap;
}
}

View file

@ -0,0 +1,11 @@
/**
* @file
* Image file styles.
*
* @see /webform/test_element_media_file
*/
img.webform-image-file {
max-width: 100%;
height: auto;
}

View file

@ -0,0 +1,102 @@
/**
* @file
* Likert element styles.
*
* @see /webform/test_element_likert
*/
/**
* Answer column widths.
*/
[data-likert-answers-count="2"] th {
width: 30%;
}
[data-likert-answers-count="3"] th {
width: 20%;
}
[data-likert-answers-count="4"] th {
width: 15%;
}
[data-likert-answers-count="5"] th {
width: 12%;
}
[data-likert-answers-count="6"] th {
width: 10%;
}
[data-likert-answers-count="7"] th {
width: 8.57%;
}
[data-likert-answers-count="8"] th {
width: 7.5%;
}
[data-likert-answers-count="9"] th {
width: 6.66%;
}
[data-likert-answers-count="10"] th {
width: 6%;
}
/**
* Basic table formatting.
*/
.webform-likert-table th,
.webform-likert-table td {
text-align: center;
}
.form-type-webform-likert td label {
display: none;
}
.webform-likert-table th:first-child,
.webform-likert-table td:first-child {
text-align: inherit;
width: 40%;
}
.form-type-webform-likert td:first-child label {
display: block;
}
/**
* Mobile support to likert webform element table.
*/
@media (max-width: 768px) {
.form-type-webform-likert table {
border-collapse: collapse;
font-size: inherit;
}
.form-type-webform-likert thead {
display: none;
}
.form-type-webform-likert tr,
.form-type-webform-likert tr.odd {
border: 0;
background: transparent;
}
.form-type-webform-likert td {
display: block;
border: 0;
background: transparent;
padding: 0;
text-align: inherit;
}
.webform-likert-table[data-likert-answers-count] th,
.webform-likert-table[data-likert-answers-count] th:first-child,
.webform-likert-table td,
.webform-likert-table td:first-child {
width: 100%;
}
.form-type-webform-likert td label {
display: inline;
}
.form-type-webform-likert td:last-child {
margin-bottom: 1em;
}
}

View file

@ -0,0 +1,16 @@
/**
* @file
* Location element styles.
*
* @see /webform/test_element_location
*/
/**
* Remove power by Google.
*
* @see http://stackoverflow.com/questions/12327651/how-to-remove-the-powered-by-google-logo-in-the-google-map-autocomplete-dropdo
*/
.pac-container:after {
background-image: none;
height: 0;
}

View file

@ -0,0 +1,76 @@
/**
* @file
* Messages element styles.
*
* @see /webform/test_element_message
*/
/**
* Add styles to default (info) message,
*/
.messages {
box-shadow: -8px 0 0 #3b3b3b; /* LTR */
}
[dir="rtl"] .messages {
box-shadow: 8px 0 0 #3b3b3b;
margin-left: 0;
}
.messages.messages--info {
color: #31708f;
background-color: #d9edf7;
background-image: url(../images/icons/info.svg);
border-color: #0074bd #0074bd #0074bd transparent; /* LTR */
box-shadow: -8px 0 0 #0074bd; /* LTR */
}
[dir="rtl"] .messages.messages--info {
border-color: #0074bd transparent #0074bd #0074bd;
box-shadow: 8px 0 0 #0074bd;
margin-left: 0;
}
/**
* Webform message close container.
*/
.webform-message--close .messages {
position: relative;
}
/**
* Webform message close link.
*/
.webform-message--close .webform-message__link {
display: none;
}
html.js .webform-message--close .webform-message__link {
display: block;
position: absolute;
top: 11px;
right: 10px;
line-height: 24px;
font-size: 24px;
}
.webform-message__link {
color: inherit;
opacity: 0.33;
}
.webform-message__link:link {
border-bottom: none;
text-decoration: none;
}
.webform-message__link:hover,
.webform-message__link:focus,
.webform-message__link:active {
border-bottom: none;
text-decoration: none;
color: inherit;
opacity: 1;
}
html.js .js-webform-message--close-storage {
display: none;
}

View file

@ -0,0 +1,103 @@
/**
* @file
* Multiple element styles.
*
* @see /webform/test_element_multiple
*/
.form-type-webform-multiple:after {
content: " ";
display: table;
clear: both;
}
.webform-multiple-table table {
margin-bottom: 2px;
}
.webform-multiple-table td {
white-space: nowrap;
}
.webform-multiple-table td:first-child {
padding: 0 0 0 1em;
width: 26px;
vertical-align: middle;
text-align: center;
}
.webform-multiple-table td:last-child {
padding: 0 2px;
vertical-align: middle;
text-align: center;
width: 60px;
}
.webform-multiple-table td:last-child input {
margin: 0 2px;
}
.webform-multiple-table td:last-child input {
opacity: 0.4;
}
.webform-multiple-table td:last-child input:hover,
.webform-multiple-table td:last-child input:focus,
.webform-multiple-table td:last-child input:active {
opacity: 1;
background: none;
}
.webform-multiple-table td select,
.webform-multiple-table td .form-type-textfield input,
.webform-multiple-table td .form-type-email input,
.webform-multiple-table td .form-type-url input,
.webform-multiple-table td .form-type-tel input,
.webform-multiple-table td .form-type-entity-autocomplete input,
.webform-multiple-table td .form-type-webform-autocomplete input {
width: 100%;
}
.webform-multiple-table td .form-type-datelist select,
.form-type-webform-multiple.webform-has-field-prefix td select,
.form-type-webform-multiple.webform-has-field-suffix td select,
.form-type-webform-multiple.webform-has-field-prefix td input,
.form-type-webform-multiple.webform-has-field-suffix td input {
width: auto;
}
.webform-multiple-table .webform-multiple-sort-weight {
width: 4em;
}
.webform-multiple-table td input[type="image"] {
padding: 0;
width: 16px;
height: 16px;
}
.webform-multiple-table .container-inline input[type="submit"] {
width: inherit;
}
/**
* Hide AJAX throbber.
*/
.form-type-webform-multiple .ajax-progress-throbber {
display: none;
}
/**
* Suppress table drag warnings.
*/
.webform-multiple-table .tabledrag-changed-warning,
.webform-multiple-table .tabledrag-changed {
display: none !important; /* Must use !important because .tabledrag-changed 'display' is set via JavaScript */
}
/**
* Tweak tabledrag toggle weight.
*/
.webform-multiple-tabledrag-toggle-weight {
float: right;
}

View file

@ -0,0 +1,38 @@
/**
* @file
* Element options display styles.
*
* @see /webform/example_layout_basic
*/
.webform-options-display-side-by-side > div {
display: inline-block;
margin-right: .5em;
}
/**
* Display columns for devices that are more than 400px wide.
*/
@media (min-width: 400px) {
.webform-options-display-two-columns {
display: inline-block;
margin-top: .4em;
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
}
.webform-options-display-three-columns {
display: inline-block;
margin-top: .4em;
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
}
.webform-options-display-two-columns div.form-item,
.webform-options-display-three-columns div.form-item {
margin-top: 0;
margin-bottom: 0;
}
}

View file

@ -0,0 +1,13 @@
/**
* @file
* Other element styles.
*
* @see /webform/test_element_other
*/
html.js .webform-select-other .webform-select-other-input,
html.js .webform-checkboxes-other .webform-checkboxes-other-input,
html.js .webform-radios-other .webform-radios-other-input,
html.js .webform-buttons-other .webform-buttons-other-input {
display: none;
}

View file

@ -0,0 +1,21 @@
/**
* @file
* Element range styles.
*
* @see /webform/example_elements#edit-range
* @see http://thenewcode.com/754/input-Antipode-The-HTML5-output-Element
*/
.form-range.form-range-output {
margin-right: 8px;
}
.form-range-output-container {
white-space: nowrap;
}
.form-range-output-container input,
.form-range-output-container .field-prefix,
.form-range-output-container .field-suffix {
margin-left: 2px;
}

View file

@ -0,0 +1,94 @@
/**
* @file
* Rating element styles.
*
* @see /webform/example_elements
*/
html.js .form-webform-rating {
display: none;
}
div.svg div.rateit-range {
background: url(../images/rating/star-normal.svg);
}
div.svg div.rateit-hover {
background: url(../images/rating/star-hover.svg);
}
div.svg div.rateit-selected {
background: url(../images/rating/star-selected.svg);
}
div.svg div.rateit-preset {
background: url(../images/rating/star-preset.svg);
}
div.svg button.rateit-reset {
background: url(../images/rating/reset-normal.svg);
}
div.svg button.rateit-reset:hover {
background: url(../images/rating/reset-hover.svg);
}
/**
* Small
*/
div.svg.rateit-small {
height: 16px;
}
div.svg.rateit-small div.rateit-range,
div.svg.rateit-small div.rateit-hover,
div.svg.rateit-small div.rateit-selected,
div.svg.rateit-small div.rateit-preset {
background-size: 16px 16px;
}
div.svg.rateit-small button.rateit-reset {
height: 16px;
width: 16px;
background-size: 16px 16px;
}
/**
* Medium
*/
div.svg.rateit-medium {
height: 24px;
}
div.svg.rateit-medium div.rateit-range,
div.svg.rateit-medium div.rateit-hover,
div.svg.rateit-medium div.rateit-selected,
div.svg.rateit-medium div.rateit-preset {
background-size: 24px 24px;
}
div.svg.rateit-medium button.rateit-reset {
height: 24px;
width: 24px;
background-size: 24px 24px;
}
/**
* Large
*/
div.svg.rateit-large {
height: 36px;
}
div.svg.rateit-large div.rateit-range,
div.svg.rateit-large div.rateit-hover,
div.svg.rateit-large div.rateit-selected,
div.svg.rateit-large div.rateit-preset {
background-size: 32px 32px;
}
div.svg.rateit-large button.rateit-reset {
height: 32px;
width: 32px;
background-size: 32px 32px;
}

View file

@ -0,0 +1,14 @@
/**
* @file
* Select2 styles.
*/
/*
* Make sure container is visible.
* - Fixes Select2 not working with dialog or system tray.
* .ui-dialog z-index is 1260. @see core/themes/seven/css/components/dialog.css
*/
.select2-container--open {
z-index: 1261;
}

View file

@ -0,0 +1,45 @@
/**
* @file
* Signature element styles.
*
* @see /webform/example_elements
* @see https://css-tricks.com/snippets/sass/maintain-aspect-ratio-mixin/
*/
.webform-signature-pad {
position: relative;
background-color: #f0f0f0;
}
.webform-signature-pad:before {
display: block;
content: "";
width: 100%;
padding-top: 33%;
}
.webform-signature-pad canvas {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
cursor: crosshair;
}
/* Position 'Reset' button in right hand corner of the canvas */
.webform-signature-pad .button {
z-index: 100;
position: absolute;
top: 2px;
right: 2px;
}
/* Add border around signature image */
.webform-signature-pad-image {
display: block;
width: 100%;
max-width: 600px; /* Max width is used to prevent signature pad from getting too wide and tall */
border: 1px solid #ccc;
}

View file

@ -0,0 +1,71 @@
/**
* @file
* States element styles.
*
* @see /webform/test_element_states
*/
.webform-states-table td {
white-space: nowrap;
}
.webform-states-table--state {
border-top: 2px solid #a6a6a6;
}
.webform-states-table--state:first-child {
border-top: inherit;
}
.webform-states-table--state td select {
width: inherit;
max-width: inherit;
}
.webform-states-table--state td:first-child select,
.webform-states-table--condition select,
.webform-states-table--condition input[type="text"] {
width: 100%;
max-width: 100%;
}
.webform-states-table .image-button {
margin: 0;
}
.webform-states-table th:last-child,
.webform-states-table td:last-child {
padding: 0 2px;
vertical-align: middle;
text-align: center;
}
.webform-states-table td:last-child input {
margin: 0 2px;
}
.webform-states-table td:last-child input {
opacity: 0.4;
}
.webform-states-table td:last-child input:hover,
.webform-states-table td:last-child input:focus,
.webform-states-table td:last-child input:active {
opacity: 1;
background: none;
}
/**
* Hide AJAX throbber.
*/
.form-type-webform-element-states .ajax-progress-throbber {
display: none;
}
/**
* Suppress table drag warnings.
*/
.webform-states-table .tabledrag-changed-warning,
.webform-states-table .tabledrag-changed {
display: none !important; /* Must use !important because .tabledrag-changed 'display' is set via JavaScript */
}

View file

@ -0,0 +1,12 @@
/**
* @file
* Table select element styles.
*
* @see /webform/test_element_table
*/
/* Make the first column containing a checkbox/radio as small as possible. */
.tableselect th:first-child,
.tableselect td:first-child {
width: 1px;
}

View file

@ -0,0 +1,12 @@
/**
* @file
* Table select sort element styles.
*
* @see /webform/test_element_table
*/
.tableselect-sort th:first-child,
.tableselect-sort td:first-child {
white-space: nowrap;
width: 40px;
}

View file

@ -0,0 +1,44 @@
/**
* @file
* Toggle element styles.
*
* @see /webform/example_elements
*/
html.js .form-type-webform-toggle .form-checkbox {
display: none;
}
html.js .form-type-webform-toggle label.option {
display: block;
float: left;
}
html.js .form-type-webform-toggle label + input + .toggle {
margin: 2px 0;
}
html.js .toggle {
display: block;
float: left;
margin: 2px .5em 2px 0;
text-transform: uppercase;
}
html.js .toggle.toggle-small,
html.js .toggle.toggle-small + label {
height: 16px;
line-height: 16px;
}
html.js .toggle.toggle-medium,
html.js .toggle.toggle-medium+ label {
height: 24px;
line-height: 24px;
}
html.js .toggle.toggle-large,
html.js .toggle.toggle-large + label {
height: 36px;
line-height: 36px;
}

View file

@ -0,0 +1,21 @@
/**
* @file
* Video file styles.
*
* @see /webform/test_element_media_file
*/
.webform-video-file {
position: relative;
max-width: 640px;
height: 0;
padding-bottom: 56.25%;
}
.webform-video-file video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

View file

@ -0,0 +1,41 @@
/**
* @file
* Webform styles.
*/
/**
* Container inline
*/
.form-item .container-inline {
margin: 2px 0;
}
/**
* Issue #2731991: Setting required on radios marks all options required.
*/
.form-checkboxes .form-required:after,
.form-radios .form-required:after {
display: none;
}
/**
* Element inline
*/
.webform-element--title-inline label {
display: inline;
}
.webform-element--title-inline label {
padding-right: 0.5em;
}
.webform-element--title-inline label::after {
content: ':';
}
/**
* Readonly inputs.
*/
.webform-readonly {
background-color: #f0f0f0;
}

View file

@ -0,0 +1,54 @@
/**
* @file
* Help styles.
*
* @see /admin/help/webform
* @see /admin/help/webform/introduction
*/
/**
* Help block.
*/
.block-help {
margin: 1em 0;
}
/**
* Help play button.
*/
.button.button-webform-play:before {
content: '► ';
font-size: .8em;
}
/**
* Help accordion.
*/
.webform-help-accordion dt {
font-weight: bold;
}
/**
* Help video.
*/
.webform-help-video-youtube {
margin: 1.5em 0;
max-width: 1024px;
border: 1px solid #000;
}
.webform-help-video-youtube--container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.webform-help-video-youtube iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

View file

@ -0,0 +1,51 @@
/**
* @file
* Navigation styles.
*
* @see /admin/structure/webform/manage/{webform_id}/submission/{webform_submission_id}
*/
/**
* Navigation.
*/
.webform-submission-navigation {
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
margin: 0.5em 0;
}
/**
* Pager.
*/
.webform-submission-pager {
margin: 0;
overflow: auto;
padding: 0.5em 0;
}
.webform-submission-pager__item {
display: inline-block;
list-style-type: none;
vertical-align: top;
}
.webform-submission-pager__item--previous {
text-align: left; /* LTR */
width: 45%;
}
[dir="rtl"] .webform-submission-pager__item--previous {
float: right;
text-align: right;
}
.webform-submission-pager__item--next {
float: right; /* LTR */
text-align: right; /* LTR */
width: 45%;
}
[dir="rtl"] .webform-submission-pager__item--next {
float: left;
text-align: left;
}

View file

@ -0,0 +1,130 @@
/**
* @file
* Wizard progress bar styles.
*
* @see /webform/example_wizard
* @see /webform/test_form_wizard_advanced
*/
/**
* Progress bar.
*
* @see https://coderwall.com/p/-7trcg/simple-css-only-wizard-progress-tracker
*/
.webform-progress-bar {
margin: 0;
padding: 0;
overflow: hidden;
font-size: smaller;
}
li.webform-progress-bar__page {
list-style-type: none;
display: inline-block;
position: relative;
margin: 0;
padding: 0;
line-height: 30px;
height: 30px;
background-color: #f0f0f0;
}
.webform-progress-bar[data-steps="2"] li {
width: 50%;
}
.webform-progress-bar[data-steps="3"] li {
width: 33%;
}
.webform-progress-bar[data-steps="4"] li {
width: 25%;
}
.webform-progress-bar[data-steps="5"] li {
width: 20%;
}
.webform-progress-bar[data-steps="6"] li {
width: 16.6%;
}
.webform-progress-bar[data-steps="7"] li {
width: 14.28%;
}
.webform-progress-bar[data-steps="8"] li {
width: 12.5%;
}
.webform-progress-bar[data-steps="9"] li {
width: 11.11%;
}
.webform-progress-bar[data-steps="10"] li {
width: 10%;
}
li.webform-progress-bar__page > b {
display: block;
padding: 0 0 0 30px;
font-weight: normal;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
li.webform-progress-bar__page--done > b {
background-color: #dbdbdb;
}
li.webform-progress-bar__page--current > b {
font-weight: bold;
}
li.webform-progress-bar__page > b:after,
li.webform-progress-bar__page > b:before {
content: "";
display: block;
width: 0;
height: 0;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: #ededed;
border-width: 15px;
}
li.webform-progress-bar__page > b:after {
top: -5px;
z-index: 1;
border-left-color: white;
border-width: 20px;
}
li.webform-progress-bar__page > b:before {
z-index: 2;
}
li.webform-progress-bar__page--done + li > b:before {
border-left-color: #dbdbdb;
}
li.webform-progress-bar__page:first-child > b:after,
li:first-child > b:before {
display: none;
}
li.webform-progress-bar__page:first-child span,
li.webform-progress-bar__page:last-child span {
display: block;
height: 0;
width: 0;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: white;
border-width: 15px;
}
li.webform-progress-bar__page:last-child span {
left: auto;
right: -15px;
border-left-color: transparent;
border-top-color: white;
border-bottom-color: white;
}

View file

@ -0,0 +1,10 @@
/**
* @file
* Wizard progress (numbering) styles.
*
* @see /webform/test_form_wizard_advanced
*/
.webform-progress__status {
text-align: center;
}

View file

@ -0,0 +1,9 @@
/**
* @file
* Bartik theme styles.
*/
/* Add background color to table cells so that very wide off-screen tables look okay. */
table {
background-color: #fff;
}

View file

@ -0,0 +1,54 @@
/**
* @file
* Seven theme styles.
*/
/* Align all tables cells top */
table td {
vertical-align: top;
}
/* Add background to nested details */
details details {
background-color: #f8f8f8;
}
details details details {
background-color: #fff;
}
/* Add white background to tooltips */
.ui-tooltip.ui-widget {
background: #fff;
}
/* Hide tabs and elements from printing. */
@media print {
.shortcut-action,
.dropbutton-wrapper,
.block-system-breadcrumb-block,
.block-local-tasks-block,
.pager,
.button-action,
.webform-submission-navigation,
.webform-filter-form {
display: none !important; /* Using !important to ensure with these elements are hidden with getting into a specificity war */
}
}
/* System tray divider */
.ui-resizable-w {
background-color: #bfbfba;
border: 1px solid #6b6b6b;
border-width: 1px 2px;
}
/* System tray title bar */
.ui-dialog.ui-dialog-offcanvas .ui-dialog-titlebar {
border-radius: 0;
}
/* System tray actions */
.ui-dialog.ui-dialog-offcanvas .ui-dialog-content .form-actions {
margin: 1em 0;
}

View file

@ -0,0 +1,105 @@
Development Cheatsheet
----------------------
### GitFlow
```bash
# Create branch
git checkout 8.x-5.x
git checkout -b [issue-number]-[issue-description]
git push -u origin [issue-number]-[issue-description]
# Create patch
git diff 8.x-5.x > [project_name]-[issue-description]-[issue-number]-00.patch
# Create interdiff
interdiff \
[issue-number]-[old-comment-number].patch \
[issue-number]-[new-comment-number].patch \
> interdiff-[issue-number]-[old-comment-number]-[new-comment-number].txt
# Merge branch with all commits
git checkout 8.x-5.x
git merge [issue-number]-[issue-description]
git push
# Merge branch as a single new commit
git checkout 8.x-5.x
git merge --squash [issue-number]-[issue-description]
git commit -m 'Issue #[issue-number]: [issue-description]'
git push
# Delete branch
git branch -D [issue-number]-[issue-description]
git push origin :[issue-number]-[issue-description]
```
**Import and Export Configuration**
```bash
# Generate *.features.yml for the webform.module and sub-modules.
# These files will be ignored. @see .gitignore.
echo 'true' > webform.features.yml
echo 'true' > modules/webform_examples/webform_examples.features.yml
echo 'true' > modules/webform_templates/webform_templates.features.yml
echo 'true' > modules/webform_node/webform_node.features.yml
# Make sure all modules that are going to be exported are enabled
drush en -y webform\
webform_demo_application_evaluation\
webform_examples\
webform_templates\
webform_test\
webform_test_element\
webform_test_handler\
webform_test_options\
webform_test_views\
webform_test_translation\
webform_node;
# Show the difference between the active config and the default config.
drush features-diff webform
drush features-diff webform_test
# Export webform configuration from your site.
drush features-export -y webform
drush features-export -y webform_demo_application_evaluation
drush features-export -y webform_examples
drush features-export -y webform_templates
drush features-export -y webform_test
drush features-export -y webform_test_element
drush features-export -y webform_test_handler
drush features-export -y webform_test_options
drush features-export -y webform_test_views
drush features-export -y webform_test_translation
drush features-export -y webform_node
# Revert all feature update to *.info.yml files.
git checkout -- *.info.yml
# Tidy webform configuration from your site.
drush webform-tidy -y --dependencies webform
drush webform-tidy -y --dependencies webform_demo_application_evaluation
drush webform-tidy -y --dependencies webform_examples
drush webform-tidy -y --dependencies webform_templates
drush webform-tidy -y --dependencies webform_test
drush webform-tidy -y --dependencies webform_test_element
drush webform-tidy -y --dependencies webform_test_handler
drush webform-tidy -y --dependencies webform_test_options
drush webform-tidy -y --dependencies webform_test_views
drush webform-tidy -y --dependencies webform_test_translation
drush webform-tidy -y --dependencies webform_node
# Re-import all webform configuration into your site.
drush features-import -y webform
drush features-import -y webform_demo_application_evaluation
drush features-import -y webform_examples
drush features-import -y webform_templates
drush features-import -y webform_test
drush features-import -y webform_test_element
drush features-import -y webform_test_handler
drush features-import -y webform_test_options
drush features-import -y webform_test_views
drush features-import -y webform_test_translation
drush features-import -y webform_node
```

View file

@ -0,0 +1,246 @@
Development Notes
-----------------
Below are useful commands that make it a little easier for
me to maintain the Webform module.
### Patching
**[Create and manage patches](https://www.drupal.org/node/707484)**
```bash
# Create and checkout issue branch
git checkout -b [issue-number]-[issue-description]
# Push issue branch to D.O. (optional)
git push -u origin [issue-number]-[issue-description]
# Create patch by comparing (current) issue branch with 8.x-5.x branch
git diff 8.x-5.x > [project_name]-[issue-description]-[issue-number]-[comment-number]-[drupal-version].patch
```
**Ignoring *.patch, *.diff, and .gitignore files**
```bash
cat >> .gitignore <<'EOF'
.gitignore
*.patch
*.diff
EOF
```
**[Apply patch](https://www.drupal.org/node/1399218)**
```bash
curl https://www.drupal.org/files/[patch-name].patch | git apply -
```
**[Revert patch](https://www.drupal.org/patch/reverse)**
```bash
curl https://www.drupal.org/files/[patch-name].patch | git apply -R -
```
### Branching
**Merge branch**
```bash
# Merge branch with all commits
git checkout 8.x-5.x
git merge [issue-number]-[issue-description]
git push
# Merge branch as a single new commit
git checkout 8.x-5.x
git merge --squash [issue-number]-[issue-description]
git commit -m 'Issue #[issue-number]: [issue-description]'
git push
```
**Exporting a branch**
```bash
# Create a zip archive for a branch
git archive --format zip --output webform-[issue-number]-[issue-description].zip [issue-number]-[issue-description]
```
**Delete issue branch**
```bash
# Delete local issue branch.
git branch -d [issue-number]-[issue-description]
# Delete remote issue branch.
git push origin :[issue-number]-[issue-description]
```
### [Interdiff](https://www.drupal.org/documentation/git/interdiff)
```bash
interdiff \
[issue-number]-[old-comment-number].patch \
[issue-number]-[new-comment-number].patch \
> interdiff-[issue-number]-[old-comment-number]-[new-comment-number].txt
```
### Drush
**Reinstall Webform module.**
```bash
drush php-eval 'module_load_include('install', 'webform'); webform_uninstall();'; drush cron;
drush php-eval 'module_load_include('install', 'webform_node'); webform_node_uninstall();'; drush cron;
drush webform-purge --all -y; drush pmu -y webform_test; drush pmu -y webform_devel; drush pmu -y webform_examples; drush pmu -y webform_templates; drush pmu -y webform_ui; drush pmu -y webform_node; drush pmu -y webform;
drush en -y webform webform_ui webform_devel webform_examples webform_templates webform_node;
# Optional.
drush en -y webform_test;
drush en -y webform_test_third_party_settings;
drush en -y webform_test_translation;
drush pmu -y webform_test_third_party_settings webform_test_translation;
```
**Reinstall Webform Test module.**
```bash
drush webform-purge --all -y; drush pmu -y webform_test; drush en -y webform_test;
```
**Install extra modules.**
```bash
drush en -y webform captcha image_captcha honeypot validators;
```
**Create test roles and users.**
```bash
drush role-create developer
drush role-add-perm developer 'view the administration theme,access toolbar,access administration pages,access content overview,access webform overview,administer webform,edit webform assets,administer blocks,administer nodes'
drush user-create developer --password="developer"
drush user-add-role developer developer
drush role-create admin
drush role-add-perm admin 'view the administration theme,access toolbar,access administration pages,access content overview,access webform overview,administer webform submission'
drush user-create admin --password="admin"
drush user-add-role admin admin
drush role-create manager
drush role-add-perm manager 'view the administration theme,access toolbar,access administration pages,access content overview,access webform overview'
drush user-create manager --password="manager"
drush user-add-role manager manager
drush role-create viewer
drush role-add-perm viewer 'view the administration theme,access toolbar,access administration pages,access content overview,access webform overview,view any webform submission'
drush user-create viewer --password="viewer"
drush user-add-role viewer viewer
drush role-create user
drush user-create user --password="user"
drush user-add-role user user
drush role-create any
drush user-create any --password="any"
drush role-add-perm any 'view the administration theme,access administration pages,access toolbar,access webform overview,edit webform assets,create webform,edit any webform,delete any webform,view webform submissions any node,edit webform submissions any node,delete webform submissions any node'
drush user-add-role any any
drush role-create own
drush user-create own --password="own"
drush role-add-perm own 'view the administration theme,access administration pages,access toolbar,access webform overview,edit webform assets,create webform,edit own webform,delete own webform,view webform submissions own node,edit webform submissions own node,delete webform submissions own node'
drush user-add-role own own
```
**Create test submissions for 'Contact' and 'Example: Elements' webform.**
```bash
drush webform-generate contact
drush webform-generate example_elements
```
**Test update hooks**
```bash
drush php-eval 'module_load_include('install', 'webform'); ($message = webform_update_8001()) ? drupal_set_message($message) : NULL;'
```
**Access developer information**
```bash
drush role-add-perm anonymous 'access devel information'
drush role-add-perm authenticated 'access devel information'
```
**Reinstall**
```bash
drush -y site-install\
--account-mail="example@example.com"\
--account-name="webmaster"\
--account-pass="drupal.admin"\
--site-mail="example@example.com"\
--site-name="Drupal 8 (Webform)";
# Enable core modules
drush -y pm-enable\
book\
simpletest\
telephone\
language\
locale\
content_translation\
config_translation;
# Disable core modules
drush -y pm-uninstall\
update;
# Enable contrib modules
drush -y pm-enable\
devel\
devel_generate\
kint\
webprofiler\
webform\
webform_devel\
webform_examples\
webform_node\
webform_templates\
webform_test\
webform_test_translation;
```
### How to take a screencast
**Setup**
- Drupal
- Install Drupal locally.
- Remove all blocks in first sidebar.
http://localhost/d8_dev/admin/structure/block
- Desktop
- Switch to laptop.
- Turn 'Hiding on' in the Dock System Preferences.
- Set screen display to 'Large Text'
- Chrome
- Hide Bookmarks.
- Hide Extra Icons.
- Always Show Toolbar in Full Screen.
- Delete all webform.* keys from local storage.
**Generate list of screencasts**
```php
$help = _webform_help();
print '<pre>';
foreach ($help as $name => $info) {
print "webform-" . $name . PHP_EOL;
print 'Webform Help: ' . $info['title'] . PHP_EOL;
print PHP_EOL;
}
print '</pre>'; exit;
```
**Uploading**
- Title : Webform Help: {title} [v01]
- Tags: Drupal 8,Webform,Form Builder
- Privacy: Unlisted

View file

@ -0,0 +1,392 @@
Features
--------
## Form Builder
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-builder.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-builder.png" alt="Form Builder" />
</a>
</div>
The Webform module provides an intuitive webform builder based upon Drupal 8's
best practices for user interface and user experience. The webform builder allows non-technical users to easily build and maintain webforms.
Form builder features include:
- Drag-n-drop webform element management
- Generation of test submissions
- Duplication of existing webforms, templates, and elements
## Form Settings
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-settings.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-settings-thumbnail.png" alt="Form Settings" />
</a>
</div>
Form submission handling, messaging, and confirmations are completely
customizable using global settings and/or form-specific settings.
Form settings that can be customized include:
- Messages and button labels
- Confirmation page, messages, and redirects
- Saving drafts
- Previewing submissions
- Confidential submissions
- Prepopulating a webform's elements using query string parameters
- Preventing duplicate submissions
- Disabling back button
- Warning users about unsaved changes
- Disabling client-side validation
- Limiting number of submission per user, per webform, and/or per node
- Look-n-feel of webform, confirmation page, and buttons
- Injection webform specific CSS and JavaScript
## Elements
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-elements.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-elements-thumbnail.png" alt="Elements" />
</a>
</div>
The Webform module is built directly on top of Drupal 8's Form API. Every
[form element](https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/8)
available in Drupal 8 is supported by the Webform module.
Form elements include:
- **HTML:** Textfield, Textareas, Checkboxes, Radios, Select menu,
Password, and more...
- **HTML5:** Email, Url, Number, Telephone, Date, Number, Range,
and more...
- **Drupal specific** File uploads, Entity References, Table select, Date list,
and more...
- **Custom:** [Likert scale](https://en.wikipedia.org/wiki/Likert_scale),
Star rating, Toggle, Buttons, Credit card number, Geolocation,
Select/Checkboxes/Radios with other, and more...
- **Markups** Inline dismissable messages, HTML Markup, Details, and Fieldsets.
- **Composite elements:** Name, Address, Contact, and Credit Card
## Element Settings
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-element-settings.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-element-settings-thumbnail.png" alt="Element Settings" />
</a>
</div>
All of Drupal 8's default webform element properties and behaviors are supported.
There are also several custom webform element properties and settings
available to enhance a webform element's behavior.
Standard and custom properties allow for:
- **Customizable required error messages**
- **Conditional logic** using [FAPI States API](https://api.drupal.org/api/examples/form_example%21form_example_states.inc/function/form_example_states_form/7)
- **Input masks** (using [jquery.inputmask](https://github.com/RobinHerbots/jquery.inputmask))
- **[Select2](https://select2.github.io/)** replacement of select boxes
- **Word and character counting** for text elements
- **Help popup** (using [jQuery UI Tooltip](https://jqueryui.com/tooltip/))
- **Regular expression pattern validation**
- **Private** elements, visible only to administrators
- **Unique** values per element
## Viewing Source
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-source.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-source-thumbnail.png" alt="Viewing Source" />
</a>
</div>
At the heart of a Webform module's webform elements is a Drupal render array,
which can be edited and managed by developers. The Drupal render array gives developers
complete control over a webform's elements, layout, and look-and-feel by
allowing developers to make bulk updates to a webform's label, descriptions, and
behaviors.
## States/Conditional Logic
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-states.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-states.png" alt="States/Conditional Logic" />
</a>
</div>
Drupal's State API can be used by developers to provide conditional logic to
hide and show webform elements.
Drupal's State API supports:
- Show/Hide
- Open/Close
- Enable/Disable
## Multistep Forms
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-wizard.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-wizard.png" alt="Multistep Forms" />
</a>
</div>
Forms can be broken up into multiple pages using a progress bar. Authenticated
users can save drafts and/or have their changes automatically saved as they
progress through a long webform.
Multistep webform features include:
- Customizable progress bar
- Customizable previous and next button labels and styles
- Saving drafts between steps
## Email & Remote Post Handlers
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-handlers.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-handlers-thumbnail.png" alt="Email/Handlers" />
</a>
</div>
Upon webform submission, customizable email notifications and confirmations can
be sent to users and administrators.
An extendable plugin that allows developers to push submitted data
to external or internal systems and/or applications is provided.
Email support features include:
- Previewing and resending emails
- Sending HTML emails
- File attachments (requires the [Mail System](https://www.drupal.org/project/mailsystem) and [Swift Mailer](https://www.drupal.org/project/swiftmailer) module.)
- HTML and plain-text email-friendly Twig templates
- Customizable display formats for individual webform elements
Remote post features include:
- Posting selected elements to remote server
- Adding custom parameters to remote post requests
## Results Management
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-results.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-results-thumbnail.png" alt="Results Management" />
</a>
</div>
Form submissions can optionally be stored in the database, reviewed, and
downloaded.
Submissions can also be flagged with administrative notes.
Results management features include:
- Flagging
- Administrative notes
- Viewing submissions as HTML, plain text, and YAML
- Customizable reports
- Downloading results as a CSV to Google Sheets or MS Excel
- Saving of download preferences per form
- Automatically purging old submissions based on certain criteria
## Access Controls
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-access.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-access-thumbnail.png" alt="Access Controls" />
</a>
</div>
The Webform module provides full access controls for managing who can create
forms, post submissions, and access a webform's results.
Access controls can be applied to roles and/or specific users.
Access controls allow users to:
- Create new forms
- Update forms
- Delete forms
- View submissions
- Update submissions
- Delete submissions
- View selected elements
- Update selected elements
## Reusable Templates
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-templates.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-templates-thumbnail.png" alt="Reusable Templates" />
</a>
</div>
The Webform module provides a few starter templates and multiple example forms
which webform administrators can update or use to create new reusable templates
for their organization.
Starter templates include:
- Contact Us
- Donation
- Employee Evaluation
- Issue
- Job Application
- Job Seeker Profile
- Registration
- Session Evaluation
- Subscribe
- User Profile
Example webforms include:
- Elements
- Basic layout
- Flexbox layout
- Input masks
- Options
- Wizard
## Reusable Options
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-options.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-options-thumbnail.png" alt="Reusable Options" />
</a>
</div>
Administrators can define reusable global options for select menus, checkboxes,
and radio buttons. The Webform module includes default options for states,
countries, [likert](https://en.wikipedia.org/wiki/Likert_scale) answers,
and more.
Reusable options include:
- Country codes & names
- Credit card codes
- Days, Months, Time zones
- Education, Employment status, Ethnicity, Industry, Languages, Marital status, Relationship, Size, and Titles
- Likert agreement, comparison, importance, quality, satisfaction, ten scale, and
would you
- State/province codes & names
- State codes & names
## Internationalization
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-internalization.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-internalization-thumbnail.png" alt="Internationalization" />
</a>
</div>
Forms and configuration can be translated into multiple languages using Drupal's
configuration translation system.
## Drupal Integration
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-integration.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-integration-thumbnail.png" alt="Drupal Integration" />
</a>
</div>
Forms can be attached to nodes or displayed as blocks. Webforms can also have
dedicated SEO-friendly URLs. Webform elements are simply render arrays that can
easily be altered using custom hooks and/or plugins.
## Add-ons & Third Party Settings
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-add-ons.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-add-ons-thumbnail.png" alt="Add-ons & Third Party Settings" />
</a>
</div>
Includes a list of modules and projects that extend and/or provide additional
functionality to the Webform module and Drupal's Form API.
## Extendable Plugins
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-plugin.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-plugin.png" alt="Extendable Plugins" />
</a>
</div>
The Webform module provides [plugins](https://www.drupal.org/developing/api/8/plugins)
and hooks that allow contrib and custom modules to extend and enhance webform
elements and submission handling.
**WebformElement plugin** is used to integrate and enhance webform elements so
that they can be properly integrated into the Webform module.
**WebformHandler plugin** allows developers to extend a webform's submission
handling.
**WebformExporter plugin** allows developers to export results using custom
formats and file types.
## Help & Video Tutorials
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-help.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-help-thumbnail.png" alt="Help & Video Tutorials" />
</a>
</div>
The Webform module provides examples, inline help, and screencast walk throughs.
Screencasts include:
- [Welcome to the Webform module](https://youtu.be/sQGsfQ_LZJ4)
- [Installing the Webform module and third party libraries](https://youtu.be/IMfFTrsjg5k)
- [Managing Webforms, Templates, and Examples](https://youtu.be/T5MVGa_3jOQ)
- [Adding Elements, Composites, and Containers](https://youtu.be/LspF9mAvRcY)
- [Configuring Webform Settings and Behaviors](https://youtu.be/UJ0y09ZS9Uc)
- [Controlling Access to Webforms and Elements](https://youtu.be/SFm76DAVjbE)
- [Collecting Submissions, Sending Emails, and Posting Results](https://youtu.be/OdfVm5LMH9A)
- [Placing Webforms in Blocks and Creating Webform Nodes](https://youtu.be/xYBW2g0osd4)
- [Administering and Extending the Webform module](https://youtu.be/bkScAX_Qbt4)
- [Using the Source](https://youtu.be/2pWkJiYeR6E)
- [Getting Help](https://youtu.be/sRXUR2c2brA)
## Drush Integration
<div class="thumbnail">
<a href="https://www.drupal.org/files/webform-8.x-5.x-drush.png">
<img src="https://www.drupal.org/files/webform-8.x-5.x-drush.png" alt="Drush Integration" />
</a>
</div>
Drush commands are provided to:
- Generate multiple webform submissions
- Export webform submissions
- Purge webform submissions
- Download and manage third party libraries
- Tidy YAML configuration files
--------------------------------------------------------------------------------
_This file was generated from [FEATURES.md](http://cgit.drupalcode.org/webform/tree/FEATURES.md?h=8.x-5.x)._

View file

@ -0,0 +1,125 @@
Known Issues
------------
Below are known Drupal 8 core issues that are affecting the Webform module.
### Configuration Management
**[Issue #2808287: Importing Webform config file via the UI is throwing serialization error](https://www.drupal.org/node/2808287)**
> Importing configuration files using Drush is working fine.
**[Issue #1920902: Unable to tidy the bulk export of Webform and WebformOptions config files
because Drupal's YAML utility is not a service.](https://www.drupal.org/node/1920902)**
> The Webform module provides drush commands to 'tidy' exported YAML and
> configuration files that so they are easier to read and edit.
### Form Elements
**[Drupal core webforms system issues](https://www.drupal.org/project/issues/drupal?status=Open&version=8.x&component=forms+system)**
> Any changes, improvements, and bug fixes for Drupal's Form API may directly
> impact the Webform module.
- [Issue #1593964: Allow FAPI usage of the datalist element](https://www.drupal.org/node/1593964)
**[Issue #2502195: Regression: Webform throws LogicException when trying to render a webform with object as an element's default value.](https://www.drupal.org/node/2502195)**
> Impacts previewing entity autocomplete elements.
**[Issue #2207383: Create a tooltip component](https://www.drupal.org/node/2207383)**
> Impacts displaying element description in a tooltip. jQuery UI's tooltip's UX
> is not great.
**[Issue #2741877: Nested modals don't work: when using CKEditor in a modal, then clicking the image button opens another modal, which closes the original modal](https://www.drupal.org/node/2741877)**
> Makes it impossible to display the CKEditor in a dialog.
> Workaround: Use custom download of CKEditor which include a CKEditor specific
> link dialog.
### \#states API (Conditionals)
#### Button (button & submit)
**[Issue #1671190 by Lucasljj, idebr, Cameron Tod: Use <button /> webform element type instead of <input type="submit" />](https://www.drupal.org/node/1671190)**
#### Date/time (datetime)
**[Issue #2419131: #states attribute does not work on #type datetime](https://www.drupal.org/node/2419131)**
#### Details (details)
**[Issue #2348851: Regression: Allow HTML tags inside detail summary](https://www.drupal.org/node/2348851)**
#### Item (item)
**[Issue #783438: #states doesn't work for #type item](https://www.drupal.org/node/783438)**
#### HTML markup (markup)
**[Issue #2700667: Notice: Undefined index: #type in drupal_process_states()](https://www.drupal.org/node/2700667)**
#### Managed file (managed_file)
**[Issue #2705471: Webform states managed file fields](https://www.drupal.org/node/2705471)**
#### Password confirm (password_confirm)
**[Issue #1427838: password and password_confirm children do not pick up #states or #attributes](https://www.drupal.org/node/1427838)**
#### Select (select)
**[Issue #1426646: "-Select-" option is lost when webform elements uses '#states'](https://www.drupal.org/node/1426646)**
**[Issue #1149078: States API doesn't work with multiple select fields](https://www.drupal.org/node/1149078)**
**[Issue #2791741: FAPI states: fields aren't hidden initially when depending on multi-value selection](https://www.drupal.org/node/2791741)**
#### Radios (radios)
**[Issue #2731991: Setting required on radios marks all options required](https://www.drupal.org/node/2731991)**
**[Issue #994360: #states cannot disable/enable radios and checkboxes](https://www.drupal.org/node/994360)**
#### Text format (text_format)
**[Issue #997826: #states doesn't work correctly with type text_format](https://www.drupal.org/node/997826)**
**[Issue #2625128: Text format selection stays visible when using editor and a hidden webform state](https://www.drupal.org/node/2625128)**
### Submission Display
**[Issue #2484693: Telephone Link field formatter breaks Drupal with 5 digits or less in the number](https://www.drupal.org/node/2720923)**
> Workaround is to manually build a static HTML link.
> See: \Drupal\webform\Plugin\WebformElement\Telephone::formatHtml
### Access Control
**[Issue #2636066: Access control is not applied to config entity queries](https://www.drupal.org/node/2636066)**
> Workaround: Manually check webform access.
> See: Drupal\webform\WebformEntityListBuilder
### User Interface
**[Issue #2235581: Make Token Dialog support inserting in WYSIWYGs (TinyMCE, CKEditor, etc.)](https://www.drupal.org/node/2235581)**
> This blocks tokens from being inserted easily into the CodeMirror widget.
> Workaround: Disable '\#click_insert' functionality from the token dialog.
**Config entity does NOT support [Entity Validation API](https://www.drupal.org/node/2015613)**
> Validation constraints are only applicable to content entities and fields.
>
> In D8 all config entity validation is handled via
\Drupal\Core\Form\FormInterface::validateForm
>
> Workaround: Created the WebformEntityElementsValidator service.
**[Issue #2585169: Unable to alter local actions prior to rendering](https://www.drupal.org/node/2585169)**
> Makes it impossible to open an action in a dialog.
> Workaround: Add local action to a controller's response.

View file

@ -0,0 +1,109 @@
Steps for creating a new release
--------------------------------
1. Cleanup code
2. Export configuration
3. Review code
4. Run tests
5. Generate release notes
6. Tag and create a new release
7. Upload screencast to YouTube
1. Cleanup code
---------------
[Convert to short array syntax](https://www.drupal.org/project/short_array_syntax)
drush short-array-syntax webform
Tidy YAML files
@see DEVELOPMENT-CHEATSHEET.md
2. Export configuration
-----------------------
@see DEVELOPMENT-CHEATSHEET.md
3. Review code
--------------
[Online](http://pareview.sh)
http://git.drupal.org/project/webform.git 8.x-5.x
[Commandline](https://www.drupal.org/node/1587138)
# Check Drupal coding standards
phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info modules/sandbox/webform
# Check Drupal best practices
phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,js,css,info modules/sandbox/webform
[File Permissions](https://www.drupal.org/comment/reply/2690335#comment-form)
# Files should be 644 or -rw-r--r--
find * -type d -print0 | xargs -0 chmod 0755
# Directories should be 755 or drwxr-xr-x
find . -type f -print0 | xargs -0 chmod 0644
4. Run tests
------------
[SimpleTest](https://www.drupal.org/node/645286)
# Run all tests
php core/scripts/run-tests.sh --url http://localhost/d8_dev --module webform
[PHPUnit](https://www.drupal.org/node/2116263)
# Execute all Webform PHPUnit tests.
cd core
php ../vendor/phpunit/phpunit/phpunit --group webform
cd core
# Execute individual PHPUnit tests.
export SIMPLETEST_DB=mysql://drupal_d8_dev:drupal.@dm1n@localhost/drupal_d8_dev;
# Functional test.
php ../vendor/phpunit/phpunit/phpunit ../modules/sandbox/webform/tests/src/Functional/WebformExampleFunctionalTest.php
# Kernal test.
php ../vendor/phpunit/phpunit/phpunit ../modules/sandbox/webform/tests/src/Kernal/Utility/WebformDialogHelperTest.php
# Unit test.
php ../vendor/phpunit/phpunit/phpunit ../modules/sandbox/webform/tests/src/Unit/Utility/WebformYamlTest.php
5. Generate release notes
-------------------------
[Git Release Notes for Drush](https://www.drupal.org/project/grn)
drush release-notes --nouser 8.x-5.0-VERSION 8.x-5.x
6. Tag and create a new release
-------------------------------
[Tag a release](https://www.drupal.org/node/1066342)
git tag 8.x-5.0-VERSION
git push --tags
git push origin tag 8.x-5.0-VERSION
[Create new release](https://www.drupal.org/node/add/project-release/2640714)
7. Upload screencast to YouTube
-------------------------------
- Title : Webform 8.x-5.x-betaXX
- Tags: Drupal 8,Webform,Form Builder
- Privacy: listed

View file

@ -0,0 +1,573 @@
<?php
/**
* @file
* Webform module drush commands.
*/
use Drupal\Core\Serialization\Yaml;
use Drupal\webform\Controller\WebformResultsExportController;
use Drupal\webform\Entity\Webform;
use Drupal\webform\Form\WebformResultsClearForm;
use Drupal\webform\Form\WebformSubmissionsPurgeForm;
use Drupal\webform\Utility\WebformYaml;
use Psr\Log\LogLevel;
/**
* Implements hook_drush_command().
*/
function webform_drush_command() {
$items = [];
/* Submissions */
$items['webform-export'] = [
'description' => 'Exports webform submissions to a file.',
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
'arguments' => [
'webform' => 'The webform ID you want to export (required unless --entity-type and --entity-id are specified)',
],
'options' => [
// Delimited export options.
'delimiter' => 'Delimiter between columns (defaults to site-wide setting). This option may need to be wrapped in quotes. i.e. --delimiter="\t".',
'multiple_delimiter' => 'Delimiter between an element with multiple values (defaults to site-wide setting).',
// Document and managed file export options.
'file-name' => 'File name used to export submission and uploaded filed. You may use tokens.',
// Tabular export options.
'header-keys' => 'Set to "label" (default) or "key"',
'options-item-format' => 'Set to "label" (default) or "key". Set to "key" to print select list values by their keys instead of labels.',
'options-format' => 'Set to "separate" (default) or "compact" to determine how select list values are exported.',
'entity-reference-format' => 'Set to "link" (default) or "id" to determine how entity references are exported.',
'excluded-columns' => 'Comma-separated list of component IDs or webform keys to exclude.',
// Download options.
'entity-type' => 'The entity type to which this submission was submitted from.',
'entity-id' => 'The ID of the entity of which this webform submission was submitted from.',
'range-type' => 'Range of submissions to export: "all", "latest", "serial", "sid", or "date".',
'range-latest' => 'Integer specifying the latest X submissions will be downloaded. Used if "range-type" is "latest" or no other range options are provided.',
'range-start' => 'The submission ID or start date at which to start exporting.',
'range-end' => 'The submission ID or end date at which to end exporting.',
'state' => 'Submission state to be included: "completed", "draft" or "all" (default).',
'sticky' => 'Flagged/starred submission status.',
'files' => 'Download files: "1" or "0" (default). If set to 1, the exported CSV file and any submission file uploads will be download in a gzipped tar file.',
// Output options.
'destination' => 'The full path and filename in which the CSV or archive should be stored. If omitted the CSV file or archive will be outputted to the commandline.',
],
'aliases' => ['wfx'],
];
$items['webform-purge'] = [
'description' => "Purge webform submissions from the databases",
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
'arguments' => [
'webform_id' => "A webform machine name. If not provided, user may choose from a list of names.",
],
'options' => [
'all' => 'Flush all submissions',
'entity-type' => 'The entity type for webform submissions to be purged',
'entity-id' => 'The ID of the entity for webform submissions to be purged',
],
'examples' => [
'drush webform-purge' => 'Pick a webform and then purge its submissions.',
'drush webform-purge contact' => "Delete 'Contact' webform submissions.",
'drush webform-purge --all' => 'Purge all webform submissions.',
],
'aliases' => ['wfp'],
];
/* Tidy */
$items['webform-tidy'] = [
'description' => "Tidy export webform configuration files",
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'options' => [
'dependencies' => 'Add module dependencies to installed webform and options configuration entities.',
],
'arguments' => [
'module' => "The module that needs its YAML configuration files (config/install) tidied. (Defaults to webform)",
],
'examples' => [
'drush webform-tidy webform' => "Tidies YAML configuration files in 'webform/config' for the Webform module",
],
'aliases' => ['wft'],
];
/* Libraries */
$items['webform-libraries-status'] = [
'description' => 'Displays the status of third party libraries required by the Webform module.',
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'webform-libraries-status' => 'Displays the status of third party libraries required by the Webform module.',
],
'aliases' => ['wfls'],
];
$items['webform-libraries-download'] = [
'description' => 'Download third party libraries required by the Webform module.',
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'webform-libraries-download' => 'Download third party libraries required by the Webform module.',
],
'aliases' => ['wfld'],
];
$items['webform-libraries-remove'] = [
'description' => 'Removes all downloaded third party libraries required by the Webform module.',
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'webform-libraries-remove' => 'Removes all downloaded third party libraries required by the Webform module.',
],
'aliases' => ['wflr'],
];
/* Devel Generate */
$items['webform-generate'] = [
'callback' => 'drush_devel_generate',
'callback arguments' => [
'plugin_id' => 'webform_submission',
],
'description' => 'Create submissions in specified webform.',
'arguments' => [
'webform_id' => 'Webform id into which new submissions will be inserted.',
'num' => 'Number of submissions to insert. Defaults to 50.',
],
'options' => [
'kill' => 'Delete all submissions in specified webform before generating.',
'feedback' => 'An integer representing interval for insertion rate logging. Defaults to 1000',
'entity-type' => 'The entity type to which this submission was submitted from.',
'entity-id' => 'The ID of the entity of which this webform submission was submitted from.',
],
'aliases' => ['wfg'],
];
/* Repair */
$items['webform-repair'] = [
'description' => 'Makes sure all Webform admin settings and webforms are up-to-date.',
'core' => ['8+'],
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
'examples' => [
'webform-repair' => 'Repairs admin settings and webforms are up-to-date.',
],
'aliases' => ['wfr'],
];
return $items;
}
/**
* Implements hook_drush_help().
*/
function webform_drush_help($section) {
switch ($section) {
case 'drush:webform-export':
return dt('This command will export webform submissions to a file.');
case 'drush:webform-purge':
return dt('This command will purge webform submissions.');
case 'drush:webform-libraries-status':
return dt('This command displays the status of third party libraries required by the Webform module.');
case 'drush:webform-libraries-download':
return dt('This command downloads third party libraries required by the Webform module.');
case 'drush:webform-libraries-remove':
return dt('This command removes all downloaded third party libraries required by the Webform module.');
case 'drush:webform-repair':
return dt('Makes sure all Webform admin settings and webforms are up-to-date. Only use this command if you are having problems with your existing Webform configuration.');
case 'drush:webform-tidy':
return dt('This command tidies exported YAML configuration files.') . "\n\n" .
dt('Changes include...') . PHP_EOL .
dt('- Preserving newlines using pipe (|).') . PHP_EOL .
dt('- Removing returns after array dashes (-).');
case 'drush:webform-generate':
return dt('This command will create submissions in specified webform.');
case 'meta:webform:title':
return dt('Webform commands');
case 'meta:webform:summary':
return dt('Enables the creation of webforms and questionnaires.');
}
}
/******************************************************************************/
// Export
/******************************************************************************/
/**
* Implements drush_hook_COMMAND_validate().
*/
function drush_webform_export_validate($webform_id = NULL) {
return _drush_webform_validate($webform_id);
}
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_export($webform_id = NULL) {
if (!$webform_id) {
$webforms = array_keys(Webform::loadMultiple());
$choices = array_combine($webforms, $webforms);
$webform_id = drush_choice($choices, dt("Choose a webform to export submissions from."));
if ($webform_id === FALSE) {
return drush_user_abort();
}
}
$webform = Webform::load($webform_id);
// @todd Determine if we should get source entity from options entity type
// and id.
$source_entity = NULL;
/** @var \Drupal\webform\WebformSubmissionExporterInterface $submission_exporter */
$submission_exporter = \Drupal::service('webform_submission.exporter');
$submission_exporter->setWebform($webform);
$submission_exporter->setSourceEntity($source_entity);
// Get command options as export options.
$export_options = drush_redispatch_get_options();
// Convert dashes to underscores.
foreach ($export_options as $key => $value) {
unset($export_options[$key]);
$export_options[str_replace('-', '_', $key)] = $value;
}
$export_options += $submission_exporter->getDefaultExportOptions();
$submission_exporter->setExporter($export_options);
WebformResultsExportController::batchSet($webform, $source_entity, $export_options);
drush_backend_batch_process();
$file_path = ($submission_exporter->isArchive()) ? $submission_exporter->getArchiveFilePath() : $submission_exporter->getExportFilePath();
if (isset($export_options['destination'])) {
drush_print(dt('Created @destination', ['@destination' => $export_options['destination']]));
file_unmanaged_copy($file_path, $export_options['destination'], FILE_EXISTS_REPLACE);
}
else {
drush_print(file_get_contents($file_path));
}
@unlink($file_path);
return NULL;
}
/******************************************************************************/
// Purge
/******************************************************************************/
/**
* Implements drush_hook_COMMAND_validate().
*/
function drush_webform_purge_validate($webform_id = NULL) {
// If webform id is set to 'all' or not included skip validation.
if (drush_get_option('all') || $webform_id == NULL) {
return;
}
return _drush_webform_validate($webform_id);
}
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_purge($webform_id = NULL) {
if (drush_get_option('all')) {
$webform_id = 'all';
}
if (!$webform_id) {
$webforms = array_keys(Webform::loadMultiple());
$choices = array_combine($webforms, $webforms);
$choices = array_merge(['all' => 'all'], $choices);
$webform_id = drush_choice($choices, dt("Choose a webform to purge submissions from."));
if ($webform_id === FALSE) {
return drush_user_abort();
}
}
// Set the webform.
$webform = ($webform_id == 'all') ? NULL : Webform::load($webform_id);
/** @var \Drupal\webform\WebformSubmissionStorageInterface $submission_storage */
$submission_storage = \Drupal::entityTypeManager()->getStorage('webform_submission');
/** @var \Drupal\webform\WebformRequestInterface $request_handler */
$request_handler = \Drupal::service('webform.request');
// Make sure there are submissions that need to be deleted.
if (!$submission_storage->getTotal($webform)) {
return drush_set_error(dt('There are no submissions that need to be deleted.'));
}
if (!$webform) {
$submission_total = \Drupal::entityQuery('webform_submission')->count()->execute();
$form_total = \Drupal::entityQuery('webform')->count()->execute();
$t_args = [
'@submission_total' => $submission_total,
'@submissions' => \Drupal::translation()->formatPlural($submission_total, t('submission'), t('submissions')),
'@form_total' => $form_total,
'@forms' => \Drupal::translation()->formatPlural($form_total, t('webform'), t('webforms')),
];
if (!drush_confirm(dt('Are you sure you want to delete @submission_total @submissions in @form_total @forms?', $t_args))) {
return drush_user_abort();
}
$form = new WebformResultsClearForm($submission_storage, $request_handler);
$form->batchSet();
drush_backend_batch_process();
}
else {
// Set source entity.
$entity_type = drush_get_option('entity-type');
$entity_id = drush_get_option('entity-id');
$source_entity = ($entity_type && $entity_id) ? \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id) : NULL;
$t_args = [
'@title' => ($source_entity) ? $source_entity->label() : $webform->label(),
];
if (!drush_confirm(dt("Are you sure you want to delete all submissions from '@title' webform?", $t_args))) {
return drush_user_abort();
}
$form = new WebformSubmissionsPurgeForm($submission_storage, $request_handler);
$form->batchSet($webform, $source_entity);
drush_backend_batch_process();
}
}
/******************************************************************************/
// Tidy
/******************************************************************************/
/**
* Implements drush_hook_COMMAND_validate().
*/
function drush_webform_tidy_validate($module = 'webform') {
if (!file_exists(drupal_get_path('module', $module) . '/config')) {
$t_args = [
'@module' => $module,
'@directory' => drupal_get_path('module', $module) . '/config',
];
return drush_set_error(dt("@module does not contain a '@module/config' directory (@directory).", $t_args));
}
}
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_tidy($module = 'webform') {
$dependencies = drush_get_option('dependencies');
$file_directory_path = drupal_get_path('module', $module) . '/config';
$files = file_scan_directory($file_directory_path, '/.*\.yml$/');
drush_print(dt('Reviewing @count YAML configuration files for the @module.module.', ['@count' => count($files), '@module' => $module]));
$total = 0;
foreach ($files as $file) {
$original_yaml = file_get_contents($file->uri);
$tidied_yaml = $original_yaml;
// Add module dependency to exporter webform and webform options config entities.
if ($dependencies && preg_match('/^(webform\.webform\.|webform\.webform_options\.)/', $file->filename)) {
try {
$data = Yaml::decode($tidied_yaml);
if (empty($data['dependencies']['enforced']['module']) || !in_array($module, $data['dependencies']['enforced']['module'])) {
drush_print(dt('Adding module dependency to @file...', ['@file' => $file->filename]));
$data['dependencies']['enforced']['module'][] = $module;
$tidied_yaml = Yaml::encode($data);
}
}
catch (\Exception $exception) {
$message = 'Error parsing: ' . $file->filename . PHP_EOL . $exception->getMessage();
if (strlen($message) > 255) {
$message = substr($message, 0, 255) . '...';
}
drush_log($message, LogLevel::ERROR);
drush_print($message);
}
}
// Tidy and add new line to the end of the tidied file.
$tidied_yaml = WebformYaml::tidy($tidied_yaml) . PHP_EOL;
if ($tidied_yaml != $original_yaml) {
drush_print(dt('Tidying @file...', ['@file' => $file->filename]));
file_put_contents($file->uri, $tidied_yaml);
$total++;
}
}
if ($total) {
drush_print(dt('@total YAML file(s) tidied.', ['@total' => $total]));
}
else {
drush_print(dt('No YAML files needed to be tidied.'));
}
}
/******************************************************************************/
// Devel Generate.
/******************************************************************************/
/**
* Implements drush_hook_COMMAND_validate().
*/
function drush_webform_generate_validate() {
// Array of "Callback arguments" and "command line args".
$params = func_get_args();
$params[0] = 'webform_submission';
_drush_plugin_validate($params);
}
/******************************************************************************/
// Libraries
/******************************************************************************/
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_libraries_status() {
module_load_include('install', 'webform');
/** @var \Drupal\webform\WebformLibrariesManagerInterface $libraries_manager */
$libraries_manager = \Drupal::service('webform.libraries_manager');
$requirements = $libraries_manager->requirements();
foreach ($requirements as $requirement) {
$library = $requirement['library'];
drush_print($library['title'] . ' (' . $library['name'] . ') ' . $requirement['value']);
// drush_print();
drush_print(strip_tags($requirement['description']));
drush_print();
}
}
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_libraries_remove($status = TRUE) {
if ($status) {
drush_print(dt('Beginning to remove libraries...'));
}
$removed = FALSE;
/** @var \Drupal\webform\WebformLibrariesManagerInterface $libraries_manager */
$libraries_manager = \Drupal::service('webform.libraries_manager');
$libraries = $libraries_manager->getLibraries();
foreach ($libraries as $library_name => $library) {
$library_path = '/' . $library['destination'] . '/' . $library['directory_name'];
$library_exists = (file_exists(DRUPAL_ROOT . $library_path)) ? TRUE : FALSE;
if ($library_exists) {
$t_args = [
'@name' => $library_name,
'@path' => $library_path,
];
if ($status) {
drush_print(dt('@name removed from @path...', $t_args));
drush_delete_dir(DRUPAL_ROOT . $library_path, TRUE);
}
$removed = TRUE;
}
}
if ($status) {
drupal_flush_all_caches();
}
return $removed;
}
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_libraries_download() {
// Remove all existing libraries.
if (drush_webform_libraries_remove(FALSE)) {
drush_print(dt('Removing existing libraries...'));
}
// Download libraries using drush.
$commandline_args = [
DRUPAL_ROOT . '/' . drupal_get_path('module', 'webform') . '/webform.libraries.make.yml',
DRUPAL_ROOT,
];
$commandline_options = ['no-core' => 'no-core'];
drush_invoke_process('@self', 'make', $commandline_args, $commandline_options);
drupal_flush_all_caches();
}
/******************************************************************************/
// Repair.
/******************************************************************************/
/**
* Implements drush_hook_COMMAND().
*/
function drush_webform_repair() {
if (!drush_confirm(dt("Are you sure you want repair the Webform module's admin settings and webforms?"))) {
return drush_user_abort();
}
module_load_include('install', 'webform');
drush_print('Repairing admin settings...');
_webform_update_admin_settings();
drush_print('Repairing webform settings...');
_webform_update_form_settings();
}
/******************************************************************************/
// Helper functions.
/******************************************************************************/
/**
* Validate webform_id argument and source entity-type and entity-id options.
*/
function _drush_webform_validate($webform_id = NULL) {
if (empty($webform_id)) {
return drush_set_error(dt('Webform id required'));
}
if (!empty($webform_id) && !Webform::load($webform_id)) {
return drush_set_error(dt('Webform @id not recognized.', ['@id' => $webform_id]));
}
$entity_type = drush_get_option('entity-type');
$entity_id = drush_get_option('entity-id');
if ($entity_type || $entity_id) {
if (empty($entity_type)) {
return drush_set_error(dt('Entity type is required when entity id is specified.'));
}
if (empty($entity_id)) {
return drush_set_error(dt('Entity id is required when entity type is specified.'));
}
$dt_args = [
'@webform_id' => $webform_id,
'@entity_type' => $entity_type,
'@entity_id' => $entity_id,
];
$source_entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);
if (!$source_entity) {
return drush_set_error(dt('Unable to load @entity_type:@entity_id', $dt_args));
}
$dt_args['@title'] = $source_entity->label();
if (empty($source_entity->webform) || empty($source_entity->webform->target_id)) {
return drush_set_error(dt("'@title' (@entity_type:@entity_id) does not reference a webform.", $dt_args));
}
if ($source_entity->webform->target_id != $webform_id) {
return drush_set_error(dt("'@title' (@entity_type:@entity_id) does not have a '@webform_id' webform associated with it.", $dt_args));
}
}
return NULL;
}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#000000" d="M3.51 13.925c.194.194.512.195.706.001l3.432-3.431c.194-.194.514-.194.708 0l3.432 3.431c.192.194.514.193.707-.001l1.405-1.417c.191-.195.189-.514-.002-.709l-3.397-3.4c-.192-.193-.192-.514-.002-.708l3.401-3.43c.189-.195.189-.515 0-.709l-1.407-1.418c-.195-.195-.513-.195-.707-.001l-3.43 3.431c-.195.194-.516.194-.708 0l-3.432-3.431c-.195-.195-.512-.194-.706.001l-1.407 1.417c-.194.195-.194.515 0 .71l3.403 3.429c.193.195.193.514-.001.708l-3.4 3.399c-.194.195-.195.516-.001.709l1.406 1.419z"/></svg>

After

Width:  |  Height:  |  Size: 582 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#0074bd" d="M8.002 1c-3.868 0-7.002 3.134-7.002 7s3.134 7 7.002 7c3.865 0 7-3.134 7-7s-3.135-7-7-7zm3 5c0 .551-.16 1.085-.477 1.586l-.158.22c-.07.093-.189.241-.361.393-.168.148-.35.299-.545.447l-.203.189-.141.129-.096.17-.021.235v.63h-2.001v-.704c.026-.396.078-.73.204-.999.125-.269.271-.498.439-.688l.225-.21-.01-.015.176-.14.137-.128c.186-.139.357-.277.516-.417l.148-.18c.098-.152.168-.323.168-.518 0-.552-.447-1-1-1s-1.002.448-1.002 1h-2c0-1.657 1.343-3 3.002-3 1.656 0 3 1.343 3 3zm-1.75 6.619c0 .344-.281.625-.625.625h-1.25c-.345 0-.626-.281-.626-.625v-1.238c0-.344.281-.625.626-.625h1.25c.344 0 .625.281.625.625v1.238z"/></svg>

After

Width:  |  Height:  |  Size: 709 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g><path fill="#0074bd" d="M12.502 7h-5c-.276 0-.502-.225-.502-.5v-5c0-.275-.225-.5-.5-.5h-3c-.275 0-.5.225-.5.5v12.029c0 .275.225.5.5.5h9.002c.275 0 .5-.225.5-.5v-6.029c0-.275-.225-.5-.5-.5zM8.502 6h4c.275 0 .34-.159.146-.354l-4.293-4.292c-.195-.195-.353-.129-.353.146v4c0 .275.225.5.5.5z"/></g></svg>

After

Width:  |  Height:  |  Size: 366 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g><path fill="#bebebe" d="M12.502 7h-5c-.276 0-.502-.225-.502-.5v-5c0-.275-.225-.5-.5-.5h-3c-.275 0-.5.225-.5.5v12.029c0 .275.225.5.5.5h9.002c.275 0 .5-.225.5-.5v-6.029c0-.275-.225-.5-.5-.5zM8.502 6h4c.275 0 .34-.159.146-.354l-4.293-4.292c-.195-.195-.353-.129-.353.146v4c0 .275.225.5.5.5z"/></g></svg>

After

Width:  |  Height:  |  Size: 366 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g><path fill="#787878" d="M12.502 7h-5c-.276 0-.502-.225-.502-.5v-5c0-.275-.225-.5-.5-.5h-3c-.275 0-.5.225-.5.5v12.029c0 .275.225.5.5.5h9.002c.275 0 .5-.225.5-.5v-6.029c0-.275-.225-.5-.5-.5zM8.502 6h4c.275 0 .34-.159.146-.354l-4.293-4.292c-.195-.195-.353-.129-.353.146v4c0 .275.225.5.5.5z"/></g></svg>

After

Width:  |  Height:  |  Size: 366 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px"><path fill="#000000" d="M0.656,9.023c0,0.274,0.224,0.5,0.499,0.5l4.853,0.001c0.274-0.001,0.501,0.226,0.5,0.5l0.001,4.853 c-0.001,0.273,0.227,0.5,0.501,0.5l1.995-0.009c0.273-0.003,0.497-0.229,0.5-0.503l0.002-4.806c0-0.272,0.228-0.5,0.499-0.502 l4.831-0.021c0.271-0.005,0.497-0.23,0.501-0.502l0.008-1.998c0-0.276-0.225-0.5-0.499-0.5l-4.852,0c-0.275,0-0.502-0.228-0.501-0.5 L9.493,1.184c0-0.275-0.225-0.499-0.5-0.499L6.997,0.693C6.722,0.694,6.496,0.92,6.495,1.195L6.476,6.026 c-0.001,0.274-0.227,0.5-0.501,0.5L1.167,6.525C0.892,6.526,0.665,6.752,0.665,7.026L0.656,9.023z"/></svg>

After

Width:  |  Height:  |  Size: 644 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#0074bd" d="M12.236 15c-.146 0-.283-.041-.406-.124l-3.828-2.583-3.83 2.583c-.123.083-.265.124-.406.124-.145 0-.289-.043-.413-.129-.246-.171-.362-.475-.292-.766l1.122-4.73-3.439-3.107c-.225-.2-.303-.519-.196-.8.106-.282.376-.468.678-.468h4.259l1.843-4.542c.109-.277.377-.458.674-.458.297 0 .564.181.674.458l1.84 4.542h4.262c.306 0 .57.186.683.468.104.281.024.601-.196.8l-3.439 3.107 1.121 4.73c.065.291-.047.595-.293.766-.129.086-.273.129-.418.129z"/></svg>

After

Width:  |  Height:  |  Size: 532 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#CD5C5C" d="M3.51 13.925c.194.194.512.195.706.001l3.432-3.431c.194-.194.514-.194.708 0l3.432 3.431c.192.194.514.193.707-.001l1.405-1.417c.191-.195.189-.514-.002-.709l-3.397-3.4c-.192-.193-.192-.514-.002-.708l3.401-3.43c.189-.195.189-.515 0-.709l-1.407-1.418c-.195-.195-.513-.195-.707-.001l-3.43 3.431c-.195.194-.516.194-.708 0l-3.432-3.431c-.195-.195-.512-.194-.706.001l-1.407 1.417c-.194.195-.194.515 0 .71l3.403 3.429c.193.195.193.514-.001.708l-3.4 3.399c-.194.195-.195.516-.001.709l1.406 1.419z"/></svg>

After

Width:  |  Height:  |  Size: 582 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#CCCCCC" d="M3.51 13.925c.194.194.512.195.706.001l3.432-3.431c.194-.194.514-.194.708 0l3.432 3.431c.192.194.514.193.707-.001l1.405-1.417c.191-.195.189-.514-.002-.709l-3.397-3.4c-.192-.193-.192-.514-.002-.708l3.401-3.43c.189-.195.189-.515 0-.709l-1.407-1.418c-.195-.195-.513-.195-.707-.001l-3.43 3.431c-.195.194-.516.194-.708 0l-3.432-3.431c-.195-.195-.512-.194-.706.001l-1.407 1.417c-.194.195-.194.515 0 .71l3.403 3.429c.193.195.193.514-.001.708l-3.4 3.399c-.194.195-.195.516-.001.709l1.406 1.419z"/></svg>

After

Width:  |  Height:  |  Size: 582 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#DAA520" d="M12.236 15c-.146 0-.283-.041-.406-.124l-3.828-2.583-3.83 2.583c-.123.083-.265.124-.406.124-.145 0-.289-.043-.413-.129-.246-.171-.362-.475-.292-.766l1.122-4.73-3.439-3.107c-.225-.2-.303-.519-.196-.8.106-.282.376-.468.678-.468h4.259l1.843-4.542c.109-.277.377-.458.674-.458.297 0 .564.181.674.458l1.84 4.542h4.262c.306 0 .57.186.683.468.104.281.024.601-.196.8l-3.439 3.107 1.121 4.73c.065.291-.047.595-.293.766-.129.086-.273.129-.418.129z"/></svg>

After

Width:  |  Height:  |  Size: 532 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#CCCCCC" d="M12.236 15c-.146 0-.283-.041-.406-.124l-3.828-2.583-3.83 2.583c-.123.083-.265.124-.406.124-.145 0-.289-.043-.413-.129-.246-.171-.362-.475-.292-.766l1.122-4.73-3.439-3.107c-.225-.2-.303-.519-.196-.8.106-.282.376-.468.678-.468h4.259l1.843-4.542c.109-.277.377-.458.674-.458.297 0 .564.181.674.458l1.84 4.542h4.262c.306 0 .57.186.683.468.104.281.024.601-.196.8l-3.439 3.107 1.121 4.73c.065.291-.047.595-.293.766-.129.086-.273.129-.418.129z"/></svg>

After

Width:  |  Height:  |  Size: 532 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#CD5C5C" d="M12.236 15c-.146 0-.283-.041-.406-.124l-3.828-2.583-3.83 2.583c-.123.083-.265.124-.406.124-.145 0-.289-.043-.413-.129-.246-.171-.362-.475-.292-.766l1.122-4.73-3.439-3.107c-.225-.2-.303-.519-.196-.8.106-.282.376-.468.678-.468h4.259l1.843-4.542c.109-.277.377-.458.674-.458.297 0 .564.181.674.458l1.84 4.542h4.262c.306 0 .57.186.683.468.104.281.024.601-.196.8l-3.439 3.107 1.121 4.73c.065.291-.047.595-.293.766-.129.086-.273.129-.418.129z"/></svg>

After

Width:  |  Height:  |  Size: 532 B

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#FFD700" d="M12.236 15c-.146 0-.283-.041-.406-.124l-3.828-2.583-3.83 2.583c-.123.083-.265.124-.406.124-.145 0-.289-.043-.413-.129-.246-.171-.362-.475-.292-.766l1.122-4.73-3.439-3.107c-.225-.2-.303-.519-.196-.8.106-.282.376-.468.678-.468h4.259l1.843-4.542c.109-.277.377-.458.674-.458.297 0 .564.181.674.458l1.84 4.542h4.262c.306 0 .57.186.683.468.104.281.024.601-.196.8l-3.439 3.107 1.121 4.73c.065.291-.047.595-.293.766-.129.086-.273.129-.418.129z"/></svg>

After

Width:  |  Height:  |  Size: 532 B

View file

@ -0,0 +1,75 @@
<?php
/**
* @file
* Webform libraries.
*/
/**
* Implements hook_library_info_alter().
*/
function webform_library_info_alter(&$libraries, $extension) {
// Only alter webform libraries.
if ($extension != 'webform') {
return;
}
// Add off-canvas system tray to dialog dependencies.
if (isset($libraries['webform.admin.dialog']) && (floatval(\Drupal::VERSION) >= 8.3) && \Drupal::moduleHandler()->moduleExists('outside_in')) {
$libraries['webform.admin.dialog']['dependencies'][] = 'outside_in/drupal.off_canvas';
$libraries['webform.admin.dialog']['dependencies'][] = 'outside_in/drupal.outside_in';
}
// Map /library/* paths to CDN.
// @see webform.libraries.yml.
foreach ($libraries as &$library) {
// Check CDN setting exists.
if (!isset($library['cdn'])) {
continue;
}
// Check if the CDN's source /library/* path exists.
reset($library['cdn']);
if (file_exists(DRUPAL_ROOT . key($library['cdn']))) {
continue;
}
_webform_library_info_alter_recursive($library, $library['cdn']);
}
}
/**
* Recursive through a webform library.
*
* @param array $library
* A webform library defined in webform.libraries.yml.
* @param array $cdn
* A associative array of library paths mapped to CDN URL.
*/
function _webform_library_info_alter_recursive(array &$library, array $cdn) {
foreach ($library as $key => &$value) {
// CSS and JS files and listed in associative arrays keyed via string.
if (!is_string($key) || !is_array($value)) {
continue;
}
// Ignore the CDN's associative array.
if ($key == 'cdn') {
continue;
}
// Replace the CDN sources (ie /library/*) with the CDN URL destination
// (https://cdnjs.cloudflare.com/ajax/libs/*).
foreach ($cdn as $source => $destination) {
if (strpos($key, $source) === 0) {
$uri = str_replace($source, $destination, $key);
$library[$uri] = $value;
unset($library[$key]);
break;
}
}
// Recurse downward to find nested libraries.
_webform_library_info_alter_recursive($value, $cdn);
}
}

View file

@ -0,0 +1,67 @@
<?php
/**
* @file
* Options alter hooks.
*/
use Drupal\webform\Utility\WebformOptionsHelper;
use Drupal\Core\Locale\CountryManager;
use Drupal\Core\Language\LanguageManager;
/**
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter().
*
* @see config/install/webform.webform.example_options.yml
*/
function webform_webform_options_range_alter(array &$options, array $element = []) {
$element += [
'#min' => 1,
'#max' => 100,
'#step' => 1,
'#pad_length' => NULL,
'#pad_str' => 0,
];
$options = WebformOptionsHelper::range(
$element['#min'],
$element['#max'],
$element['#step'],
$element['#pad_length'],
$element['#pad_str']
);
}
/**
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter().
*/
function webform_webform_options_time_zones_alter(array &$options, array $element = []) {
$options = system_time_zones();
}
/**
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter().
*/
function webform_webform_options_country_codes_alter(array &$options, array $element = []) {
$options = CountryManager::getStandardList();
}
/**
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter().
*/
function webform_webform_options_country_names_alter(array &$options, array $element = []) {
$countries = CountryManager::getStandardList();
$options = array_combine($countries, $countries);
}
/**
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter().
*/
function webform_webform_options_languages_alter(array &$options, array $element = []) {
$languages = LanguageManager::getStandardLanguageList();
unset($languages['en-x-simple']);
$options = [];
foreach ($languages as $language) {
$options[$language[0]] = $language[0];
}
}

View file

@ -0,0 +1,815 @@
<?php
/**
* @file
* Preprocessors and helper functions to make theming easier.
*/
use Drupal\Core\Link;
use Drupal\Core\Render\Element;
use Drupal\Core\Url;
use Drupal\Core\Serialization\Yaml;
use Drupal\Core\Template\Attribute;
use Drupal\Component\Utility\Xss;
use Drupal\webform\Element\WebformCodeMirror;
use Drupal\webform\WebformMessageManagerInterface;
use Drupal\webform\Utility\WebformYaml;
use Drupal\webform\Utility\WebformDateHelper;
use Drupal\webform\Utility\WebformDialogHelper;
use Drupal\webform\Utility\WebformElementHelper;
/**
* Prepares variables for webform help.
*
* Default template: webform_help.html.twig.
*
* @param array $variables
* An associative array containing:
* - title: Help title.
* - content: Help content.
*/
function template_preprocess_webform_help(array &$variables) {
$help_info = $variables['info'];
$variables += $help_info;
$help = [];
if (is_array($help_info['content'])) {
$help['content'] = $help_info['content'];
}
else {
$help['content'] = [
'#markup' => $help_info['content'],
];
}
// Build watch video link.
/** @var \Drupal\webform\WebformHelpManagerInterface $help_manager */
$help_manager = \Drupal::service('webform.help_manager');
// If help info load the video else this is the video info.
$video_info = (isset($help_info['video_id'])) ? $help_manager->getVideo($help_info['video_id']) : $help_info;
if (!empty($video_info['youtube_id'])) {
$classes = ['button', 'button-action', 'button--small', 'button-webform-play'];
$video_display = \Drupal::config('webform.settings')->get('ui.video_display');
switch ($video_display) {
case 'dialog':
$help['link'] = [
'#type' => 'link',
'#title' => t('Watch video'),
'#url' => Url::fromRoute('webform.help', ['id' => str_replace('_', '-', $video_info['id'])]),
'#attributes' => WebformDialogHelper::getModalDialogAttributes(1000, $classes),
'#prefix' => ' ',
];
break;
case 'link':
$help['link'] = [
'#type' => 'link',
'#title' => t('Watch video'),
'#url' => Url::fromUri('https://youtu.be/' . $video_info['youtube_id']),
'#attributes' => ['class' => $classes],
'#prefix' => ' ',
];
break;
case 'hidden':
default:
break;
}
}
$variables['help'] = $help;
}
/**
* Prepares variables for webform templates.
*
* Default template: webform.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #action, #method, #attributes, #webform_children.
*/
function template_preprocess_webform(array &$variables) {
template_preprocess_form($variables);
}
/**
* Prepares variables for webform actions templates.
*
* Default template: webform-actions.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties and buttons.
*
* @see \Drupal\webform\WebformSubmissionForm::actionsElement
* @see \Drupal\webform\WebformSubmissionForm::actions
*/
function template_preprocess_webform_actions(array &$variables) {
$element = $variables['element'];
// Buttons include submit, previous, next, and draft.
foreach (Element::children($element) as $key) {
$variables[$key] = $element[$key];
}
}
/**
* Prepares variables for webform confirmation templates.
*
* Default template: webform-confirmation.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_confirmation(array &$variables) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $variables['webform'];
/** @var \Drupal\Core\Entity\EntityInterface $source_entity */
$source_entity = $variables['source_entity'];
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
/** @var \Drupal\webform\WebformMessageManagerInterface $message_manager */
$message_manager = \Drupal::service('webform.message_manager');
$message_manager->setWebform($webform);
$message_manager->setSourceEntity($source_entity);
$message_manager->setWebformSubmission($webform_submission);
$settings = $webform->getSettings();
// Set progress.
if ($webform->getPages() && $settings['wizard_complete'] && ($settings['wizard_progress_bar'] || $settings['wizard_progress_pages'] || $settings['wizard_progress_percentage'])) {
$variables['progress'] = [
'#theme' => 'webform_progress',
'#webform' => $webform,
'#current_page' => 'complete',
];
}
// Set message.
$variables['message'] = $message_manager->build(WebformMessageManagerInterface::SUBMISSION_CONFIRMATION);
// Set attributes.
$variables['attributes'] = new Attribute($settings['confirmation_attributes']);
// Set back.
$variables['back'] = $settings['confirmation_back'];
$variables['back_label'] = $settings['confirmation_back_label'] ?: \Drupal::config('webform.settings')->get('settings.default_confirmation_back_label');
$variables['back_attributes'] = new Attribute($settings['confirmation_back_attributes']);
// Apply all passed query string parameters to the 'Back to form' link.
$query = \Drupal::request()->query->all();
unset($query['webform_id']);
$options = ($query) ? ['query' => $query] : [];
// Set back_url.
if ($source_entity && $source_entity->hasLinkTemplate('canonical')) {
$variables['back_url'] = $source_entity->toUrl('canonical', $options)->toString();
}
elseif ($webform_submission) {
$variables['back_url'] = $webform_submission->getSourceUrl()->toString();
}
else {
$variables['back_url'] = $webform->toUrl('canonical', $options)->toString();
}
}
/**
* Prepares variables for webform submission navigation templates.
*
* Default template: webform-submission-navigation.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
* - rel: Webform submission link template.
* (canonical, edit-form, resend-form, html, text, or yaml).
*/
function template_preprocess_webform_submission_navigation(array &$variables) {
/** @var \Drupal\webform\WebformRequestInterface $request_handler */
$request_handler = \Drupal::service('webform.request');
/** @var \Drupal\webform\WebformSubmissionStorageInterface $webform_submission_storage */
$webform_submission_storage = \Drupal::entityTypeManager()->getStorage('webform_submission');
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
// Get the route name, parameters, and source entity for the current page.
// This ensures that the user stays within their current context as they are
// paging through submission.
$route_name = \Drupal::routeMatch()->getRouteName();
$route_parameters = \Drupal::routeMatch()->getRawParameters()->all();
$source_entity = $request_handler->getCurrentSourceEntity('webform_submission');
if (strpos(\Drupal::routeMatch()->getRouteName(), 'webform.user.submission') !== FALSE) {
$account = \Drupal::currentUser();
}
else {
$account = NULL;
}
if ($previous_submission = $webform_submission_storage->getPreviousSubmission($webform_submission, $source_entity, $account)) {
$variables['prev_url'] = Url::fromRoute($route_name, ['webform_submission' => $previous_submission->id()] + $route_parameters)->toString();
}
if ($next_submission = $webform_submission_storage->getNextSubmission($webform_submission, $source_entity, $account)) {
$variables['next_url'] = Url::fromRoute($route_name, ['webform_submission' => $next_submission->id()] + $route_parameters)->toString();
}
$variables['#attached']['library'][] = 'webform/webform.navigation';
}
/**
* Prepares variables for webform submission information template.
*
* Default template: webform-submission-information.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_submission_information(array &$variables) {
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
$webform = $webform_submission->getWebform();
$variables['webform_id'] = $webform->id();
$variables['serial'] = $webform_submission->serial();
$variables['sid'] = $webform_submission->id();
$variables['uuid'] = $webform_submission->uuid();
$variables['is_draft'] = $webform_submission->isDraft() ? t('Yes') : t('No');
$variables['current_page'] = $webform_submission->getCurrentPageTitle();
$variables['remote_addr'] = $webform_submission->getRemoteAddr();
$variables['submitted_by'] = $webform_submission->getOwner()->toLink();
$variables['webform'] = $webform->toLink();
$variables['created'] = WebformDateHelper::format($webform_submission->getCreatedTime());
$variables['completed'] = WebformDateHelper::format($webform_submission->getCompletedTime());
$variables['changed'] = WebformDateHelper::format($webform_submission->getChangedTime());
$variables['sticky'] = $webform_submission->isSticky() ? t('Yes') : '';
$variables['notes'] = $webform_submission->getNotes();
// @see \Drupal\Core\Field\Plugin\Field\FieldFormatter\LanguageFormatter::viewValue()
$languages = \Drupal::languageManager()->getNativeLanguages();
$langcode = $webform_submission->get('langcode')->value;
$variables['language'] = isset($languages[$langcode]) ? $languages[$langcode]->getName() : $langcode;
if ($source_url = $webform_submission->getSourceUrl()) {
$variables['uri'] = Link::fromTextAndUrl($source_url->setAbsolute(FALSE)->toString(), $source_url);;
}
if ($webform->getSetting('token_update')) {
$token_url = $webform_submission->getTokenUrl();
$variables['token_update'] = Link::fromTextAndUrl($token_url->setAbsolute(FALSE)->toString(), $token_url);
}
if (($source_entity = $webform_submission->getSourceEntity()) && $source_entity->hasLinkTemplate('canonical')) {
$variables['submitted_to'] = $source_entity->toLink();
}
$variables['submissions_view'] = FALSE;
if ($webform->access('submission_view_any')) {
$variables['submissions_view'] = TRUE;
}
elseif ($source_entity) {
$entity_type = $source_entity->getEntityTypeId();
if (\Drupal::currentUser()->hasPermission("view webform node submissions any $entity_type")) {
$variables['submissions_view'] = TRUE;
}
elseif (\Drupal::currentUser()->hasPermission("view webform node submissions own $entity_type")
&& method_exists($source_entity, 'getOwnerId')
&& $source_entity->getOwnerId() == \Drupal::currentUser()->id()
) {
$variables['submissions_view'] = TRUE;
}
}
}
/**
* Prepares variables for webform submission HTML template.
*
* Default template: webform-submission-html.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_submission_html(array &$variables) {
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
/** @var \Drupal\webform\WebformSubmissionViewBuilderInterface $view_builder */
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('webform_submission');
$webform = $webform_submission->getWebform();
$data = $webform_submission->getData();
$elements = $webform->getElementsInitialized();
$variables['data'] = $view_builder->buildElements($elements, $data);
}
/**
* Prepares variables for webform submission table template.
*
* Default template: webform-submission-table.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_submission_table(array &$variables) {
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
/** @var \Drupal\webform\WebformSubmissionViewBuilderInterface $view_builder */
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('webform_submission');
$webform = $webform_submission->getWebform();
$data = $webform_submission->getData();
$elements = $webform->getElementsInitializedFlattenedAndHasValue();
$variables['table'] = $view_builder->buildTable($elements, $data);
}
/**
* Prepares variables for webform submission plain text template.
*
* Default template: webform-submission-text.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_submission_text(array &$variables) {
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
$variables['sid'] = $webform_submission->id();
$variables['uuid'] = $webform_submission->uuid();
$variables['is_draft'] = $webform_submission->isDraft() ? t('Yes') : t('No');
$variables['current_page'] = $webform_submission->getCurrentPage();
$variables['remote_addr'] = $webform_submission->getRemoteAddr();
$variables['submitted_by'] = $webform_submission->getOwner()->label();
$variables['webform'] = $webform_submission->getWebform()->label();
$variables['created'] = WebformDateHelper::format($webform_submission->getCreatedTime());
$variables['completed'] = WebformDateHelper::format($webform_submission->getCompletedTime());
$variables['changed'] = WebformDateHelper::format($webform_submission->getChangedTime());
// @see \Drupal\Core\Field\Plugin\Field\FieldFormatter\LanguageFormatter::viewValue()
$languages = \Drupal::languageManager()->getNativeLanguages();
$langcode = $webform_submission->get('langcode')->value;
$variables['language'] = isset($languages[$langcode]) ? $languages[$langcode]->getName() : $langcode;
if ($source_url = $webform_submission->getSourceUrl()) {
$variables['uri'] = $source_url->toString();
}
if ($source_entity = $webform_submission->getSourceEntity()) {
$variables['submitted_to'] = $source_entity->label();
}
/** @var \Drupal\webform\WebformSubmissionViewBuilderInterface $view_builder */
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('webform_submission');
$webform = $webform_submission->getWebform();
$data = $webform_submission->getData();
$elements = $webform->getElementsInitialized();
$variables['data'] = $view_builder->buildElements($elements, $data, [], 'text');
}
/**
* Prepares variables for webform submission YAML template.
*
* Default template: webform-submission-yaml.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform_submission: A webform submission.
*/
function template_preprocess_webform_submission_yaml(array &$variables) {
/** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
$webform_submission = $variables['webform_submission'];
$data = $webform_submission->toArray(TRUE, TRUE);
$yaml = Yaml::encode($data);
$yaml = WebformYaml::tidy($yaml);
$variables['yaml'] = [
'#markup' => $yaml,
'#allowed_tags' => Xss::getAdminTagList(),
];;
}
/**
* Prepares variables for webform CodeMirror template.
*
* Default template: webform-codemirror.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - code: The code.
* - type: The type of code.
*/
function template_preprocess_webform_codemirror(array &$variables) {
$variables['mode'] = WebformCodeMirror::getMode($variables['type']);
if (is_string($variables['code'])) {
$variables['code'] = [
'#markup' => $variables['code'],
'#allowed_tags' => Xss::getAdminTagList(),
];
}
}
/**
* Prepares variables for webform element base HTML template.
*
* Default template: webform-element-base-html.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - multiline: Flag to determine if value spans multiple lines.
* - email: Flag to determine if element is for an email.
*/
function template_preprocess_webform_element_base_html(array &$variables) {
$element = $variables['element'];
$variables['title'] = (WebformElementHelper::isTitleDisplayed($element)) ? $element['#title'] : NULL;
}
/**
* Prepares variables for webform element base text template.
*
* Default template: webform-element-base-text.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - multiline: Flag to determine if value spans multiple lines.
* - email: Flag to determine if element is for an email.
*/
function template_preprocess_webform_element_base_text(array &$variables) {
template_preprocess_webform_element_base_html($variables);
}
/**
* Prepares variables for webform container base HTML template.
*
* Default template: webform-container-base-html.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - multiline: Flag to determine if value spans multiple lines.
* - email: Flag to determine if element is for an email.
*/
function template_preprocess_webform_container_base_html(array &$variables) {
$element = $variables['element'];
$variables['title'] = (isset($element['#title'])) ? $element['#title'] : NULL;
$variables['id'] = $element['#webform_id'];
}
/**
* Prepares variables for webform container base text template.
*
* Default template: webform-container-base-text.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - multiline: Flag to determine if value spans multiple lines.
* - email: Flag to determine if element is for an email.
*/
function template_preprocess_webform_container_base_text(array &$variables) {
$element = $variables['element'];
$variables['title'] = (isset($element['#title'])) ? $element['#title'] : NULL;
}
/**
* Prepares variables for webform 'wizard' progress template.
*
* Default template: webform-progress.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform: A webform.
* - current_page: The current wizard page.
*/
function template_preprocess_webform_progress(array &$variables) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $variables['webform'];
$current_page = $variables['current_page'];
$pages = $webform->getPages();
$page_keys = array_keys($pages);
$page_indexes = array_flip($page_keys);
$current_index = $page_indexes[$current_page];
$total = count($page_keys);
if ($webform->getSetting('wizard_progress_bar')) {
$variables['bar'] = [
'#theme' => 'webform_progress_bar',
'#webform' => $variables['webform'],
'#current_page' => $variables['current_page'],
];
}
if ($webform->getSetting('wizard_progress_pages')) {
$variables['summary'] = t('Page @start of @end', ['@start' => $current_index + 1, '@end' => $total]);
}
if ($webform->getSetting('wizard_progress_percentage')) {
$variables['percentage'] = number_format(($current_index / ($total - 1)) * 100, 0) . '%';
}
}
/**
* Prepares variables for webform 'wizard' progress bar template.
*
* Default template: webform-progress-bar.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - webform: A webform.
* - current_page: The current wizard page.
*/
function template_preprocess_webform_progress_bar(array &$variables) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $variables['webform'];
$current_page = $variables['current_page'];
$pages = $webform->getPages();
$page_keys = array_keys($pages);
$page_indexes = array_flip($page_keys);
$current_index = $page_indexes[$current_page];
$variables['current_index'] = $current_index;
// Reset the pages variable.
$variables['progress'] = [];
foreach ($pages as $page) {
$variables['progress'][] = (isset($page['#title'])) ? $page['#title'] : '';
}
}
/******************************************************************************/
// Element templates
/******************************************************************************/
/**
* Prepares variables for Webform message templates.
*
* Default template: webform-message.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #id, #attributes, #children.
*
* @see template_preprocess_container()
*/
function template_preprocess_webform_message(array &$variables) {
$variables['has_parent'] = FALSE;
$element = $variables['element'];
// Ensure #attributes is set.
$element += ['#attributes' => []];
// Special handling for webform elements.
if (isset($element['#array_parents'])) {
// Assign an html ID.
if (!isset($element['#attributes']['id'])) {
$element['#attributes']['id'] = $element['#id'];
}
$variables['has_parent'] = TRUE;
}
$variables['message'] = $element['#message'];
$variables['attributes'] = $element['#attributes'];
if (isset($element['#closed'])) {
$variables['closed'] = $element['#closed'];
}
}
/******************************************************************************/
// Composite templates
/******************************************************************************/
/**
* Prepares variables for address composite element templates.
*
* Default template: webform-element-address.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_address(array &$variables) {
$element = $variables['element'];
foreach (Element::children($element) as $key) {
if ($element[$key]['#access']) {
$variables['content'][$key] = $element[$key];
}
}
$variables['flexbox'] = (isset($element['#flexbox'])) ? $element['#flexbox'] : FALSE;
}
/**
* Prepares variables for contact composite element templates.
*
* Default template: webform-element-contact.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_contact(array &$variables) {
$element = $variables['element'];
foreach (Element::children($element) as $key) {
if ($element[$key]['#access']) {
$variables['content'][$key] = $element[$key];
}
}
$variables['flexbox'] = (isset($element['#flexbox'])) ? $element['#flexbox'] : FALSE;
}
/**
* Prepares variables for creditcard composite element templates.
*
* Default template: webform-element-creditcard.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_creditcard(array &$variables) {
$element = $variables['element'];
foreach (Element::children($element) as $key) {
if ($element[$key]['#access']) {
$variables['content'][$key] = $element[$key];
}
}
$variables['flexbox'] = (isset($element['#flexbox'])) ? $element['#flexbox'] : FALSE;
}
/**
* Prepares variables for location composite element templates.
*
* Default template: webform-element-location.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_location(array &$variables) {
$variables['content'] = $variables['element'];
}
/**
* Prepares variables for name composite element templates.
*
* Default template: webform-element-name.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_name(array &$variables) {
$element = $variables['element'];
foreach (Element::children($element) as $key) {
if ($element[$key]['#access']) {
$variables['content'][$key] = $element[$key];
}
}
$variables['flexbox'] = (isset($element['#flexbox'])) ? $element['#flexbox'] : FALSE;
}
/**
* Prepares variables for telephone composite element templates.
*
* Default template: webform-element-telephone.html.twig.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes.
*/
function template_preprocess_webform_composite_telephone(array &$variables) {
$element = $variables['element'];
foreach (Element::children($element) as $key) {
if ($element[$key]['#access']) {
$variables['content'][$key] = $element[$key];
}
}
}
/******************************************************************************/
// Element templates
/******************************************************************************/
/**
* Prepares variables for a managed file element.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - file: The element's File object.
*/
function template_preprocess_webform_element_managed_file(array &$variables) {
/** @var \Drupal\file\FileInterface $file */
$file = $variables['file'];
$variables['uri'] = file_create_url($file->getFileUri());
$variables['extension'] = strtolower(pathinfo($variables['uri'], PATHINFO_EXTENSION));
$variables['type'] = \Drupal::service('file.mime_type.guesser')->guess($variables['uri']);
$variables['file_link'] = [
'#theme' => 'file_link',
'#file' => $file,
];
}
/**
* Prepares variables for an audio file element.
*
* Default template: webform-element-audio-file.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - file: The element's File object.
*/
function template_preprocess_webform_element_audio_file(array &$variables) {
template_preprocess_webform_element_managed_file($variables);
}
/**
* Prepares variables for a document file element.
*
* Default template: webform-element-document-file.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - file: The element's File object.
*/
function template_preprocess_webform_element_document_file(array &$variables) {
template_preprocess_webform_element_managed_file($variables);
}
/**
* Prepares variables for an image file element.
*
* Default template: webform-element-image-file.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - file: The element's File object.
*/
function template_preprocess_webform_element_image_file(array &$variables) {
template_preprocess_webform_element_managed_file($variables);
}
/**
* Prepares variables for a video file element.
*
* Default template: webform-element-video-file.html.twig.
*
* @param array $variables
* An associative array containing the following key:
* - element: The webform element.
* - value: The content for the element.
* - options Associative array of options for element.
* - file: The element's File object.
*/
function template_preprocess_webform_element_video_file(array &$variables) {
template_preprocess_webform_element_managed_file($variables);
}

View file

@ -0,0 +1,136 @@
<?php
/**
* @file
* Webform module translation hooks.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Entity\Webform;
use Drupal\webform\Utility\WebformYaml;
use Drupal\Core\Serialization\Yaml;
use Drupal\webform\Utility\WebformElementHelper;
/**
* Implements hook_form_FORM_ID_alter().
*/
function webform_form_config_translation_add_form_alter(&$form, FormStateInterface $form_state, $is_new = TRUE) {
// Manually apply YAML editor to text field that store YAML data.
foreach ($form['config_names'] as $config_name => &$config_element) {
if ($config_name == 'webform.settings') {
_webform_form_config_translate_add_form_alter_yaml_element($config_element['test']['types']);
_webform_form_config_translate_add_form_alter_yaml_element($config_element['test']['names']);
}
elseif (strpos($config_name, 'webform.webform_options.') === 0) {
_webform_form_config_translate_add_form_alter_yaml_element($config_element['options']);
}
elseif (strpos($config_name, 'webform.webform.') === 0) {
$webform_id = str_replace('webform.webform.', '', $config_name);
$webform = Webform::load($webform_id);
/** @var \Drupal\webform\WebformTranslationManagerInterface $translation_manager */
$translation_manager = \Drupal::service('webform.translation_manager');
$translation_langcode = $form_state->get('config_translation_language')->getId();;
$source_elements = $translation_manager->getSourceElements($webform);
$translation_elements = $translation_manager->getTranslationElements($webform, $translation_langcode);
$source_value = trim(Yaml::encode($source_elements));
$translation_value = trim(Yaml::encode($translation_elements));
_webform_form_config_translate_add_form_alter_yaml_element($config_element['elements'], $source_value, $translation_value);
$config_element['elements']['translation']['#description'] = t('Please note: Custom properties will be automatically removed.');
$form_state->set('webform_config_name', $config_name);
$form_state->set('webform_source_elements', $source_elements);
$form['#validate'][] = '_webform_form_config_translate_add_form_validate';
}
}
}
/**
* Validate callback; Validates and cleanups webform elements.
*/
function _webform_form_config_translate_add_form_validate(&$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
$config_name = $form_state->get('webform_config_name');
$source_elements = $form_state->get('webform_source_elements');
$submitted_translation_elements = Yaml::decode($values['translation']['config_names'][$config_name]['elements']);
$translation_elements = $source_elements;
// Remove all custom translation properties.
WebformElementHelper::merge($translation_elements, $submitted_translation_elements);
// Remove any translation property that has not been translated.
_webform_form_config_translate_add_form_filter_elements($translation_elements, $source_elements);
// Update webform value.
$values['translation']['config_names'][$config_name]['elements'] = ($translation_elements) ? Yaml::encode($translation_elements) : '';
$form_state->setValues($values);
}
/**
* Merge element properties.
*
* @param array $translation_elements
* An array of elements.
* @param array $source_elements
* An array of elements to be merged.
*/
function _webform_form_config_translate_add_form_filter_elements(array &$translation_elements, array $source_elements) {
foreach ($translation_elements as $key => &$translation_element) {
if (!isset($source_elements[$key])) {
continue;
}
$source_element = $source_elements[$key];
if ($translation_element == $source_element) {
unset($translation_elements[$key]);
}
elseif (is_array($translation_element)) {
_webform_form_config_translate_add_form_filter_elements($translation_element, $source_element);
if (empty($translation_element)) {
unset($translation_elements[$key]);
}
}
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function webform_form_config_translation_edit_form_alter(&$form, FormStateInterface $form_state) {
webform_form_config_translation_add_form_alter($form, $form_state, FALSE);
}
/**
* Alter translated config entity property.
*
* @param array $element
* A webform element containing 'source' and 'translation'.
* @param string $source_value
* (optional) The custom config source value.
* @param string $translation_value
* (optional) The custom config translation value.
*/
function _webform_form_config_translate_add_form_alter_yaml_element(array &$element, $source_value = NULL, $translation_value = NULL) {
// Source.
$element['source']['#wrapper_attributes']['class'][] = 'webform-translation-source';
$element['source']['value'] = [
'#type' => 'webform_codemirror',
'#mode' => 'yaml',
'#value' => WebformYaml::tidy($source_value ?: trim(strip_tags($element['source']['#markup']))),
'#disabled' => TRUE,
'#attributes' => ['readonly' => TRUE],
];
unset($element['source']['#markup']);
// Translation.
$element['translation']['#type'] = 'webform_codemirror';
$element['translation']['#mode'] = 'yaml';
if ($translation_value) {
$element['translation']['#default_value'] = $translation_value;
}
$element['translation']['#default_value'] = trim($element['translation']['#default_value']);
$element['#attached']['library'][] = 'webform/webform.admin.translation';
}

View file

@ -0,0 +1,41 @@
/**
* @file
* Jquery plugin to find common ancestor.
*
* @see http://stackoverflow.com/questions/3217147/jquery-first-parent-containing-all-children
*/
(function ($) {
'use strict';
jQuery.fn.commonAncestor = function() {
var parents = [];
var minlen = Infinity;
$(this).each(function() {
var curparents = $(this).parents();
parents.push(curparents);
minlen = Math.min(minlen, curparents.length);
});
for (var i in parents) {
parents[i] = parents[i].slice(parents[i].length - minlen);
}
// Iterate until equality is found
for (var i = 0; i < parents[0].length; i++) {
var equal = true;
for (var j in parents) {
if (parents[j][i] != parents[0][i]) {
equal = false;
break;
}
}
if (equal) return $(parents[0][i]);
}
return $([]);
}
})(jQuery);

View file

@ -0,0 +1,61 @@
/**
* @file
* Javascript behaviors for admin pages.
*/
(function ($, Drupal) {
'use strict';
/**
* Filter webform autocomplete handler.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformFilterAutocomplete = {
attach: function (context) {
$('.webform-filter-form input.form-autocomplete', context).once('webform-autocomplete')
.each(function () {
// If input value is an autocomplete match, reset the input to its
// default value.
if (/\(([^)]+)\)$/.test(this.value)) {
this.value = this.defaultValue;
}
// From: http://stackoverflow.com/questions/5366068/jquery-ui-autocomplete-submit-onclick-result
$(this).bind('autocompleteselect', function (event, ui) {
if (ui.item) {
$(this).val(ui.item.value);
this.form.submit();
}
});
});
}
};
/**
* Allow table rows to be hyperlinked.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformTableRowHref = {
attach: function (context) {
// Only attach the click event handler to the entire table and determine
// which row triggers the event.
$('.webform-results__table', context).once('webform-results-table').click(function (event) {
if (event.target.tagName == 'A' || event.target.tagName == 'BUTTON') {
return true;
}
var $tr = $(event.target).parents('tr[data-webform-href]');
if (!$tr.length) {
return true;
}
window.location = $tr.attr('data-webform-href');
return false;
});
}
};
})(jQuery, Drupal);

Some files were not shown because too many files have changed in this diff Show more