Skip to content

Commit bc9687c

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

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-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: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515
{% endblock %}
1616

1717
{% block form %}
18+
{{ dump(form_section_update.identifier.vars.id) }}
1819
{{ form_start(form_section_update, {'attr': {'class': 'update-section'}}) }}
1920
<section>
2021
<div class="card ibexa-card ibexa-card--light">
2122
<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' } }) }}
23+
{{ form_row(form_section_update.name, {
24+
row_attr: { class: 'ibexa-form-field' },
25+
attr: { 'data-autogenerate-identifier-target-selector': '#' ~ form_section_update.identifier.vars.id }
26+
}) }}
27+
{{ form_row(form_section_update.identifier, {
28+
row_attr: { class: 'ibexa-form-field' }
29+
}) }}
2430
</div>
2531
</div>
2632
</section>

0 commit comments

Comments
 (0)