Skip to content

Commit 4ac82dd

Browse files
Fix docs and upgrade path for 3.0 (#424)
* Remove type declaration from sulu_form_api route Remove unnecessary type declaration for sulu_form_api. * Fix form rendering in dynamic.md * Remove debug dump from dynamic.md Remove debug dump of resource in dynamic.md. * Update form rendering in dynamic.md * Improve form rendering instructions in upgrade guide Updated Twig template for form handling in UPGRADE-3.0.md. * Update UPGRADE-3.0.md * Update UPGRADE-3.0.md Co-authored-by: Alexander Schranz <alexander@sulu.io> * Update UPGRADE-3.0.md --------- Co-authored-by: Alexander Schranz <alexander@sulu.io>
1 parent be070b7 commit 4ac82dd

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

Resources/doc/dynamic.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ has been submitted successfully!
8989
<body>
9090
{% if content.form %}
9191
{% if app.request.get('send') != 'true' %}
92+
{% set form_view = sulu_form_build(content.form, 'page', resource.id) %}
9293
{# FORM THEME #}
93-
{% form_theme content.form '@SuluForm/themes/basic.html.twig' %}
94-
{{ form(content.form) }}
94+
{% form_theme form_view '@SuluForm/themes/basic.html.twig' %}
95+
{{ form(form_view) }}
9596
{% else %}
9697
{{ view.form.entity.successText|raw }}
9798
{% endif %}

Resources/doc/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ Add the following lines to `config/routes/sulu_admin.yaml`
6363

6464
```yml
6565
sulu_form_api:
66-
type: rest
6766
resource: "@SuluFormBundle/Resources/config/routing_api.yml"
6867
prefix: /admin/api
6968
```

UPGRADE-3.0.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@ The `SingleFormSelection` content type has been replaced with the new Sulu 3.0 c
1010

1111
The form is no longer built during content resolution. Instead, use the new `sulu_form_build` Twig function to build the form at render time:
1212

13-
**before:**
14-
15-
```twig
16-
{{ form(content.formProperty) }}
17-
```
18-
19-
**after:**
20-
21-
```twig
22-
{% set form = sulu_form_build(content.formProperty, 'page', page.id) %}
23-
{% if form %}
24-
{{ form(form) }}
13+
```diff
14+
{% if content.form %}
15+
{% if app.request.get('send') != 'true' %}
16+
- {% form_theme content.form '@SuluForm/themes/basic.html.twig' %}
17+
- {{ form(content.form) }}
18+
+ {% set form_view = sulu_form_build(content.form, 'page', resource.id) %}
19+
+ {% form_theme form_view '@SuluForm/themes/basic.html.twig' %}
20+
+ {{ form(form_view) }}
21+
{% else %}
22+
{{ view.form.entity.successText|raw }}
23+
{% endif %}
2524
{% endif %}
2625
```
2726

0 commit comments

Comments
 (0)