Skip to content

Commit 321e72c

Browse files
committed
Document ICensorshipFormField
Closes #538
1 parent 8fbda2e commit 321e72c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/php/api/form_builder/form_fields.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ SingleSelectionFormField::create('example')
445445
### `TextFormField`
446446

447447
`TextFormField` is a form field that allows entering a single line of text.
448-
The class implements `IAttributeFormField`, `IAutoCompleteFormField`, `ICssClassFormField`, `IImmutableFormField`, `II18nFormField`, `IInputModeFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, `IPatternFormField`, and `IPlaceholderFormField`.
448+
The class implements `IAttributeFormField`, `IAutoCompleteFormField`, `ICensorshipFormField`, `ICssClassFormField`, `IImmutableFormField`, `II18nFormField`, `IInputModeFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, `IPatternFormField`, and `IPlaceholderFormField`.
449449

450450
Example:
451451

@@ -883,7 +883,7 @@ WysiwygFormContainer::create('message')
883883

884884
`WysiwygFormField` is used for wysiwyg editor form fields.
885885
This class should, in general, not be used directly but only via `WysiwygFormContainer`.
886-
The class implements `IAttributeFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, and `IObjectTypeFormNode` and requires an object type of the object type definition `com.woltlab.wcf.message`.
886+
The class implements `IAttributeFormField`, `ICensorshipFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, and `IObjectTypeFormNode` and requires an object type of the object type definition `com.woltlab.wcf.message`.
887887
The following methods are specific to this form field class:
888888

889889
- `autosaveId($autosaveId)` and `getAutosaveId()` can be used enable automatically saving the current editor contents in the browser using the given id.

docs/php/api/form_builder/structure.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ By default, form fields are not auto-focused.
293293
`TAutoFocusFormField` provides a default implementation of these two methods.
294294

295295

296+
#### `ICensorshipFormField`
297+
298+
`ICensorshipFormField` has to be implemented by form fields that support the censorship function.
299+
The implementing class has to implement the methods `censorship(bool $censorship = true): static`, `hasCensorship(): bool`, and `validateCensorship(string $text): void`.
300+
`TCensorshipFormField` provides a default implementation of these methods.
301+
302+
!!! warning "The implementing class has to validate the entered value manually by calling `validateCensorship()`."
303+
304+
296305
#### `ICssClassFormField`
297306

298307
`ICssClassFormField` has to be implemented by form fields for which CSS classes can be added to the actual form element (in addition to adding CSS classes to the surrounding element via the class-related methods of `IFormNode`).

0 commit comments

Comments
 (0)