Skip to content

Commit 08b420c

Browse files
Merge pull request #1278 from creative-commoners/pulls/6.2/doclint
DOC Linting
2 parents 045f6c0 + edfd0f5 commit 08b420c

13 files changed

+125
-177
lines changed

.doclintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/en/

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"require-dev": {
4242
"phpunit/phpunit": "^9.6",
4343
"squizlabs/php_codesniffer": "^3",
44+
"silverstripe/documentation-lint": "^1",
4445
"silverstripe/standards": "^1",
4546
"phpstan/extension-installer": "^1.3"
4647
},
@@ -70,6 +71,11 @@
7071
"images"
7172
]
7273
},
74+
"config": {
75+
"allow-plugins": {
76+
"dealerdirect/phpcodesniffer-composer-installer": true
77+
}
78+
},
7379
"prefer-stable": true,
7480
"minimum-stability": "dev"
7581
}
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
---
2+
title: Installation
3+
---
4+
15
# Installation
26

37
Installation should be done using Composer:
48

5-
```
9+
```bash
610
composer require silverstripe/userforms
711
```
812

913
## Configuration
1014

1115
After installation, make sure you rebuild your database through `dev/build`.
1216

13-
You should see a new page type in the CMS called 'User Defined Form'. This has a new 'Form' tab which has your form builder.
17+
You should see a new page type in the CMS called "User Defined Form". This has a new "Form" tab which has your form builder.
1418

1519
### File uploads and security
1620

@@ -20,17 +24,17 @@ so they can be viewed later by CMS authors. Small files
2024
are also attached to the (optional) email notifications
2125
to any configured recipients.
2226

23-
Allowed file extensions can be configured globally through `File.allowed_extensions`,
27+
Allowed file extensions can be configured globally through [`File.allowed_extensions`](api:SilverStripe\Assets\File->allowed_extensions),
2428
and default to a safe set of files (e.g. disallowing `*.php` uploads).
25-
You can define further exclusions through the `EditableFileField.allowed_extensions_blacklist`
29+
You can define further exclusions through the [`EditableFileField.allowed_extensions_blacklist`](api:SilverStripe\UserForms\Model\EditableFormField\EditableFileField->allowed_extensions_blacklist)
2630
configuration setting.
2731

2832
The allowed upload size can be set in the CMS as long as it doesn't exceed the PHP configuration
2933
for this website (the smaller value of `upload_max_filesize` or `post_max_size`).
3034

3135
### Securing uploaded files
3236

33-
By adding a File Upload Field to your user form you can allow your website users to upload files, which will be stored in a user-defined folder in your SilverStripe system. You can access these files via the "Submissions" tab, or from the "Files" area in the admin interface.
37+
By adding a File Upload Field to your user form you can allow your website users to upload files, which will be stored in a user-defined folder in your Silverstripe CMS system. You can access these files via the "Submissions" tab, or from the "Files" area in the admin interface.
3438

3539
Please be aware that the responsibility of choosing a folder for files to be uploaded into is that of the CMS user. You can set the necessary "can view" permissions for the folder you create and/or choose via the "Files" section, then select that folder in the settings for the File Upload Field in your form.
3640

@@ -44,18 +48,18 @@ In other cases, submissions could be expected to contain private data.
4448

4549
If you want to use custom email templates set the following config option.
4650

47-
```yaml
51+
```yml
4852
SilverStripe\UserForms\Model\UserDefinedForm:
4953
email_template_directory: mysite/templates/custom_userforms_emails/
5054
```
5155
52-
Any SilverStripe templates placed in your `email_template_directory` directory will be available for use with submission emails.
56+
Any templates placed in your `email_template_directory` directory will be available for use with submission emails.
5357

5458
### Custom multi-step button text
5559

5660
If you want to change the button text when using the Multi-Step/Page Break feature, simply add the following to your `config.yml`:
5761

58-
```yaml
62+
```yml
5963
SilverStripe\UserForms\Form\UserForm:
6064
button_text: 'Your Text Here'
6165
```
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
---
2+
title: Creating custom fields
3+
---
4+
15
# Creating custom fields
26

37
To create and use your own custom fields, depending on what you want to accomplish, you may need to create two
48
new classes subclassed from the following:
59

6-
- `EditableFormField` - this Field represents what will be seen/used in the CMS userforms interface
7-
- `FormField` - this Field represents what will be seen/used in the frontend user form when the above field has been
10+
- [`EditableFormField`](api:SilverStripe\UserForms\Model\EditableFormField) - this Field represents what will be seen/used in the CMS userforms interface
11+
- [`FormField`](api:SilverStripe\Forms\FormField) - this Field represents what will be seen/used in the frontend user form when the above field has been
812
added
913

1014
## How (without the "why")
@@ -13,9 +17,9 @@ You need to create your own subclass of `EditableFormField` (the field which wil
1317
implement the method `getFormField()`, which will need to return an instantiated `FormField` to be used in the
1418
frontend form.
1519

16-
`EditableTextField` and `TextField` are two existing classes and probably the best example to look in to.
20+
[`EditableTextField`](api:SilverStripe\UserForms\Model\EditableFormField\EditableTextField) and [`TextField`](api:SilverStripe\Forms\TextField) are two existing classes and probably the best example to look in to.
1721

18-
## Why two different Fields?
22+
## Why two different fields?
1923

2024
Consider the following example (`EditableTextField` and `TextField`).
2125

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1+
---
2+
title: Troubleshooting
3+
---
4+
15
# Troubleshooting
26

37
Check the below if you have any issues during installation or use
48

5-
## Installation Issues
9+
## Installation issues
610

711
After installation make sure you have done a `dev/build` you may also need to flush the admin view by appending
8-
`?flush=1` to the URL, e.g. `http://yoursite.com/admin?flush=1`
12+
`?flush=1` to the URL, e.g. `https://example.com/admin?flush=1`
913

10-
## Checkbox or Radio group custom messages not showing
14+
## Checkbox or radio group custom messages not showing
1115

1216
If your project has a custom template for `UserFormsCheckboxSetField.ss` or `UserFormsOptionSetField.ss`, then you will need to ensure they include `$Top.getValidationAttributesHTML().RAW`. See
13-
* [UserFormsCheckboxSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss)
14-
* [UserFormsOptionSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsOptionSetField.ss)
1517

16-
## UserForms EditableFormField Column Clean task
18+
- [UserFormsCheckboxSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsCheckboxSetField.ss)
19+
- [UserFormsOptionSetField.ss](../../templates/SilverStripe/UserForms/FormField/UserFormsOptionSetField.ss)
20+
21+
## UserForms `EditableFormField` column clean task
1722

18-
This task is used to clear unused columns from EditableFormField database tables.
23+
This [`UserFormsColumnCleanTask`](api:SilverStripe\UserForms\Task\UserFormsColumnCleanTask) task is used to clear unused columns from EditableFormField database tables.
1924

2025
The reason to clear these columns is because having surplus forms can break form saving.
2126

2227
Currently it only supports MySQL and when it is run it queries the EditableFormField class for the valid columns,
2328
it then grabs the columns for the live database. It will create a backup of the table and then remove any columns that
2429
are surplus.
2530

26-
To run the task, log in as an administrator and go to to http://yoursite/dev/tasks/UserFormsColumnCleanTask in your browser, or run `sake dev/tasks/UserFormsColumnCleanTask` from the command line.
31+
To run the task, log in as an administrator and go to `https://example.com/dev/tasks/UserFormsColumnCleanTask` in your browser, or run `sake dev/tasks/UserFormsColumnCleanTask` from the command line.
2732

2833
## My CSV export times out or runs out of memory
2934

docs/en/compiling-front-end-files.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

docs/en/index.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
1+
---
2+
title: UserForms
3+
---
4+
15
# UserForms
26

37
UserForms enables CMS users to create dynamic forms via a drag and drop interface
48
and without getting involved in any PHP code.
59

610
## Features
711

8-
* Construct a form using all major form fields (text, email, dropdown, radio, checkbox..)
9-
* Ability to extend userforms from other modules to provide extra fields.
10-
* Ability to email multiple people the form submission
11-
* Custom email templates
12-
* View submitted submissions and export them to CSV
13-
* Define custom error messages and validation settings
14-
* Optionally display and hide fields using javascript based on users input
15-
16-
## Documentation
17-
18-
* [Installation instructions](installation.md)
19-
* [Troubleshooting](troubleshooting.md)
20-
* [User Documentation](userguide/index.md)
21-
* [Compiling Front-End Files](compiling-front-end-files.md)
22-
* [Creating Custom Fields](creating-custom-fields.md)
23-
* [Upgrading to SilverStripe 4](upgrading.md)
12+
- Construct a form using all major form fields (text, email, dropdown, radio, checkbox..)
13+
- Ability to extend userforms from other modules to provide extra fields.
14+
- Ability to email multiple people the form submission
15+
- Custom email templates
16+
- View submitted submissions and export them to CSV
17+
- Define custom error messages and validation settings
18+
- Optionally display and hide fields using JavaScript based on users input
2419

2520
## Thanks
2621

@@ -29,3 +24,5 @@ testers, clients who use the module and everyone that submits new features.
2924

3025
A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing
3126
the custom icon set for the form fields.
27+
28+
[CHILDREN includeFolders]

docs/en/upgrading.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/en/userguide/creating-and-editing-forms.md renamed to docs/en/userguide/01_creating-and-editing-forms.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ drop-down menu will show up. Select "User Defined Form" Then hit the "Go" button
1818

1919
You will notice that a new page has been created, with the name of "New User Defined Form." You will be taken to edit the page once you click "Create."
2020

21-
<div class="note" markdown="1">
22-
Don't worry if you create your page in the "wrong" place. Pages can be moved and re-ordered
23-
easily.
24-
</div>
21+
> [!NOTE]
22+
> Don't worry if you create your page in the "wrong" place. Pages can be moved and re-ordered easily.
2523
2624
## Combining forms and content
2725

@@ -31,10 +29,10 @@ however. You will notice in a newly created form page, there is some text in the
3129
of the editing menu to begin with: "$UserDefinedForm"
3230

3331
The purpose of this little block of text is to tell the website where in the page you
34-
would like to put the form. The form will appear on the website wherever the "$UserDefinedForm"
32+
would like to put the form. The form will appear on the website wherever the `$UserDefinedForm`
3533
appears in the editing pane, whether it is before text, after text, inside a table, etc.
3634

37-
If $UserDefinedForm is deleted by accident (or on purpose), SilverStripe automatically
35+
If $UserDefinedForm is deleted by accident (or on purpose), Silverstripe CMS automatically
3836
puts the form at the end of all the content.
3937

4038
![Form in content](_images/form-in-content.png)
@@ -67,3 +65,10 @@ Each message links to it's corresponding field so users can easily make the requ
6765
The 'Configuration' tab has a number of options used for customising your form's behaviour and appearance.
6866

6967
![Configuration](_images/userforms-config.png)
68+
69+
## Creating a multi-page form
70+
71+
To create a multi-page form, simply click the "Add Page Break" button.
72+
This will create a page break field which is used to create a new page in the form. You can drag and drop this page break to separate form fields at the desired location.
73+
74+
![Multi-page forms](_images/multi-page-forms.png)

0 commit comments

Comments
 (0)