Skip to content

Commit fc337ad

Browse files
committed
Add code examples for form structure
1 parent 79dadca commit fc337ad

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/php/api/form_builder/structure.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ The implementing class has to implement the methods `objectType($objectType)`, `
115115

116116
!!! warning "This class should generally not be relied on. Instead, `TemplateFormNode` should be used."
117117

118+
Example:
119+
120+
```php
121+
CustomFormNode::create('example')
122+
->content('html code')
123+
```
124+
118125

119126
### `TemplateFormNode`
120127

@@ -127,6 +134,13 @@ The implementing class has to implement the methods `objectType($objectType)`, `
127134
If no template has been set and the node is rendered, an exception will be thrown.
128135
- `variables(array $variables)` and `getVariables()` can be used to set and get additional variables passed to the template.
129136

137+
Example:
138+
139+
```php
140+
TemplateFormNode::create('example')
141+
->templateName('example_template_name')
142+
```
143+
130144

131145
## Form Document
132146

@@ -210,6 +224,15 @@ The methods of the interfaces that `FormContainer` is implementing are well docu
210224
- `appendChild(IFormChildNode $child)`, `appendChildren(array $children)`, and `insertBefore(IFormChildNode $child, $referenceNodeId)` are used to insert new children into the form container.
211225
- `description($languageItem = null, array $variables = [])` and `label($languageItem = null, array $variables = [])` are used to set the description and the label or title of the form container.
212226

227+
Example:
228+
229+
```php
230+
$form->appendChild(
231+
FormContainer::create('example')
232+
->appendChildren([ ... ])
233+
);
234+
```
235+
213236

214237
## Form Field
215238

0 commit comments

Comments
 (0)