Skip to content

Commit

Permalink
Add code examples for form structure
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntimeX committed Jul 30, 2024
1 parent 79dadca commit fc337ad
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/php/api/form_builder/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ The implementing class has to implement the methods `objectType($objectType)`, `

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

Example:

```php
CustomFormNode::create('example')
->content('html code')
```


### `TemplateFormNode`

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

Example:

```php
TemplateFormNode::create('example')
->templateName('example_template_name')
```


## Form Document

Expand Down Expand Up @@ -210,6 +224,15 @@ The methods of the interfaces that `FormContainer` is implementing are well docu
- `appendChild(IFormChildNode $child)`, `appendChildren(array $children)`, and `insertBefore(IFormChildNode $child, $referenceNodeId)` are used to insert new children into the form container.
- `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.

Example:

```php
$form->appendChild(
FormContainer::create('example')
->appendChildren([ ... ])
);
```


## Form Field

Expand Down

0 comments on commit fc337ad

Please sign in to comment.