Skip to content

Commit 786c0d0

Browse files
committed
Added autogenerate identifier to create/edit section form
1 parent 7a23184 commit 786c0d0

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/bundle/Resources/views/themes/admin/section/create.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@
1818
{{ form_start(form_section_create) }}
1919
<div class="card ibexa-card ibexa-card--light">
2020
<div class="card-body ibexa-card__body ibexa-form-block">
21-
{{ form_row(form_section_create.name, { row_attr: { class: 'ibexa-form-field' }, attr: {'autofocus': 'autofocus'} }) }}
22-
{{ form_row(form_section_create.identifier, { row_attr: { class: 'ibexa-form-field' } }) }}
21+
{{ form_row(form_section_create.name, {
22+
row_attr: { class: 'ibexa-form-field'},
23+
attr: {
24+
'autofocus': 'autofocus',
25+
'data-autogenerate-identifier-target-selector': '#section_create_identifier'
26+
}
27+
}) }}
28+
{{ form_row(form_section_create.identifier, {
29+
row_attr: { class: 'ibexa-form-field' }
30+
}) }}
2331
</div>
2432
</div>
2533
{{ form_widget(form_section_create.create, {'attr': {'hidden': 'hidden'}}) }}

src/bundle/Resources/views/themes/admin/section/update.html.twig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
<section>
2020
<div class="card ibexa-card ibexa-card--light">
2121
<div class="card-body ibexa-card__body ibexa-form-block">
22-
{{ form_row(form_section_update.name, { row_attr: { class: 'ibexa-form-field' } }) }}
23-
{{ form_row(form_section_update.identifier, { row_attr: { class: 'ibexa-form-field' } }) }}
22+
{{ form_row(form_section_update.name, {
23+
row_attr: { class: 'ibexa-form-field' },
24+
attr: { 'data-autogenerate-identifier-target-selector': '#' ~ form_section_update.identifier.vars.id }
25+
}) }}
26+
{{ form_row(form_section_update.identifier, {
27+
row_attr: { class: 'ibexa-form-field' }
28+
}) }}
2429
</div>
2530
</div>
2631
</section>

0 commit comments

Comments
 (0)