Skip to content

Commit 6fa7ce7

Browse files
authored
adds feedback form (#92)
* adds feedback form * coding standards fixes * adds a README.md * removes dump() * adds status message after installing module * updates README
1 parent adc94e6 commit 6fa7ce7

File tree

7 files changed

+284
-0
lines changed

7 files changed

+284
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# LocalGov Forms - Feedback Form
2+
3+
## What is it?
4+
This is a small module that creates a feedback for for your LocalGov Drupal website.
5+
6+
It asks a simple question: "Was this page helpful?".
7+
8+
If someone answers "Yes", they are asked if they'd like to share what is good about this page. If they answer "No", they have the opportunity to say how the page can be improved.
9+
10+
## How to use it.
11+
- Install it like any other Drupal module from the "Extend" page.
12+
- Add a block of type "Webform" to your site via the `Admin > Structure > Blocks` page.
13+
- When the form is submitted, results will be stored in the database. They can be accessed by going to `Admin > Structure > Webforms`, clicking on the "LocalGov Forms Feedback Form", and then choosing "Results".
14+
15+
## Considerations
16+
When you enable this module, the form that is created is set to store data in your website's database. This is the default datastore for webforms. However, this may not be where your data protection officer wishes you to store webform submissions. Check with your DPO before deploying this to a live site, or else edit the form configuration to store the data somewhere else - a CRM, an offsite backup, a separate database, etc.
17+
18+
Maintainers:
19+
- Mark Conroy
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
langcode: en
2+
status: open
3+
dependencies: { }
4+
weight: 0
5+
open: null
6+
close: null
7+
uid: 1
8+
template: false
9+
archive: false
10+
id: localgov_forms_feedback_form
11+
title: 'Feedback Form'
12+
description: 'A simple "was this page helpful" feedback form.'
13+
categories: { }
14+
elements: |-
15+
was_this_page_helpful:
16+
'#type': radios
17+
'#title': 'Was this page helpful?'
18+
'#options':
19+
'Yes': 'Yes'
20+
'No': 'No'
21+
response_for_yes:
22+
'#type': textarea
23+
'#title': 'Great. Want to tell us what you liked about it?'
24+
'#states':
25+
visible:
26+
':input[name="was_this_page_helpful"]':
27+
value: 'Yes'
28+
response_for_no:
29+
'#type': textarea
30+
'#title': 'Sorry to hear that. How can we improve it?'
31+
'#states':
32+
visible:
33+
':input[name="was_this_page_helpful"]':
34+
value: 'No'
35+
css: localgov-forms-feedback-form
36+
javascript: ''
37+
settings:
38+
ajax: false
39+
ajax_scroll_top: form
40+
ajax_progress_type: ''
41+
ajax_effect: ''
42+
ajax_speed: null
43+
page: true
44+
page_submit_path: ''
45+
page_confirm_path: ''
46+
page_theme_name: ''
47+
form_title: source_entity_webform
48+
form_submit_once: false
49+
form_open_message: ''
50+
form_close_message: ''
51+
form_exception_message: ''
52+
form_previous_submissions: false
53+
form_confidential: false
54+
form_confidential_message: ''
55+
form_disable_remote_addr: true
56+
form_convert_anonymous: false
57+
form_prepopulate: false
58+
form_prepopulate_source_entity: false
59+
form_prepopulate_source_entity_required: false
60+
form_prepopulate_source_entity_type: ''
61+
form_unsaved: false
62+
form_disable_back: false
63+
form_submit_back: false
64+
form_disable_autocomplete: false
65+
form_novalidate: false
66+
form_disable_inline_errors: false
67+
form_required: false
68+
form_autofocus: false
69+
form_details_toggle: false
70+
form_reset: false
71+
form_access_denied: default
72+
form_access_denied_title: ''
73+
form_access_denied_message: ''
74+
form_access_denied_attributes: { }
75+
form_file_limit: ''
76+
form_attributes:
77+
class:
78+
- localgov-forms-feedback-form
79+
form_method: ''
80+
form_action: ''
81+
share: false
82+
share_node: false
83+
share_theme_name: ''
84+
share_title: true
85+
share_page_body_attributes: { }
86+
submission_label: ''
87+
submission_exception_message: ''
88+
submission_locked_message: ''
89+
submission_log: false
90+
submission_excluded_elements: { }
91+
submission_exclude_empty: false
92+
submission_exclude_empty_checkbox: false
93+
submission_views: { }
94+
submission_views_replace: { }
95+
submission_user_columns:
96+
- serial
97+
- created
98+
submission_user_duplicate: false
99+
submission_access_denied: default
100+
submission_access_denied_title: ''
101+
submission_access_denied_message: ''
102+
submission_access_denied_attributes: { }
103+
previous_submission_message: ''
104+
previous_submissions_message: ''
105+
autofill: false
106+
autofill_message: ''
107+
autofill_excluded_elements: { }
108+
wizard_progress_bar: false
109+
wizard_progress_pages: false
110+
wizard_progress_percentage: false
111+
wizard_progress_link: false
112+
wizard_progress_states: false
113+
wizard_start_label: ''
114+
wizard_preview_link: false
115+
wizard_confirmation: true
116+
wizard_confirmation_label: ''
117+
wizard_auto_forward: true
118+
wizard_auto_forward_hide_next_button: false
119+
wizard_keyboard: true
120+
wizard_track: ''
121+
wizard_prev_button_label: ''
122+
wizard_next_button_label: ''
123+
wizard_toggle: false
124+
wizard_toggle_show_label: ''
125+
wizard_toggle_hide_label: ''
126+
wizard_page_type: container
127+
wizard_page_title_tag: h2
128+
preview: 0
129+
preview_label: ''
130+
preview_title: ''
131+
preview_message: ''
132+
preview_attributes: { }
133+
preview_excluded_elements: { }
134+
preview_exclude_empty: true
135+
preview_exclude_empty_checkbox: false
136+
draft: none
137+
draft_multiple: false
138+
draft_auto_save: false
139+
draft_saved_message: ''
140+
draft_loaded_message: ''
141+
draft_pending_single_message: ''
142+
draft_pending_multiple_message: ''
143+
confirmation_type: inline
144+
confirmation_url: ''
145+
confirmation_title: 'Thanks for your feedback'
146+
confirmation_message: 'Thank you for that feedback, we will use it to improve our website.'
147+
confirmation_attributes: { }
148+
confirmation_back: false
149+
confirmation_back_label: ''
150+
confirmation_back_attributes: { }
151+
confirmation_exclude_query: false
152+
confirmation_exclude_token: false
153+
confirmation_update: false
154+
limit_total: null
155+
limit_total_interval: null
156+
limit_total_message: ''
157+
limit_total_unique: false
158+
limit_user: null
159+
limit_user_interval: null
160+
limit_user_message: ''
161+
limit_user_unique: false
162+
entity_limit_total: null
163+
entity_limit_total_interval: null
164+
entity_limit_user: null
165+
entity_limit_user_interval: null
166+
purge: none
167+
purge_days: null
168+
results_disabled: false
169+
results_disabled_ignore: false
170+
results_customize: false
171+
token_view: false
172+
token_update: false
173+
token_delete: false
174+
serial_disabled: false
175+
access:
176+
create:
177+
roles:
178+
- anonymous
179+
- authenticated
180+
users: { }
181+
permissions: { }
182+
view_any:
183+
roles: { }
184+
users: { }
185+
permissions: { }
186+
update_any:
187+
roles: { }
188+
users: { }
189+
permissions: { }
190+
delete_any:
191+
roles: { }
192+
users: { }
193+
permissions: { }
194+
purge_any:
195+
roles: { }
196+
users: { }
197+
permissions: { }
198+
view_own:
199+
roles: { }
200+
users: { }
201+
permissions: { }
202+
update_own:
203+
roles: { }
204+
users: { }
205+
permissions: { }
206+
delete_own:
207+
roles: { }
208+
users: { }
209+
permissions: { }
210+
administer:
211+
roles: { }
212+
users: { }
213+
permissions: { }
214+
test:
215+
roles: { }
216+
users: { }
217+
permissions: { }
218+
configuration:
219+
roles: { }
220+
users: { }
221+
permissions: { }
222+
handlers: { }
223+
variants: { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.localgov-forms-feedback-form .fieldset-wrapper > * {
2+
display: flex;
3+
gap: 1rem;
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: LocalGov Forms Feedback Form
2+
type: module
3+
description: A simple feedback form for LocalGov Drupal.
4+
package: LocalGov Drupal
5+
core_version_requirement: ^10 || ^11
6+
dependencies:
7+
- 'webform:webform'
8+
- 'webform:webform_ui'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Install, update, and uninstall functions for LGD Forms Feedback Form module.
6+
*/
7+
8+
/**
9+
* Implements hook_install().
10+
*/
11+
function localgov_forms_feedback_form_install() {
12+
\Drupal::messenger()->addStatus(t('You have installed the LocalGov Forms Feedback Form. This form stores the form submissions in the database. Make sure you have checked this is okay with your data protection officer, or else change the form settings to store the data somewhere else.'));
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
localgov_forms_feedback_form:
2+
css:
3+
theme:
4+
css/localgov-forms-feedback-form.css: {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Module file for the Localgov Forms Feedback Form module.
6+
*/
7+
8+
/**
9+
* Implements hook_form_FORM_ID_alter().
10+
*/
11+
function localgov_forms_feedback_form_form_webform_submission_localgov_forms_feedback_form_add_form_alter(&$form, $form_state, $form_id) {
12+
$form['#attached']['library'][] = 'localgov_forms_feedback_form/localgov_forms_feedback_form';
13+
}

0 commit comments

Comments
 (0)