[CONTROLLER][Feeds] Add block prefixes to distinguish form groups
[TWIG] Divide form into various groupings for clearer representation
This commit is contained in:
parent
c8ba81897c
commit
f92c00c7aa
@ -2,13 +2,6 @@ input {
|
||||
all: unset;
|
||||
}
|
||||
|
||||
input+label {
|
||||
-webkit-align-self: center;
|
||||
-ms-flex-item-align: center;
|
||||
-ms-grid-row-align: center;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
input[type=checkbox],input[type=radio] {
|
||||
all: unset;
|
||||
display: inline-block;
|
||||
|
@ -147,10 +147,10 @@ class Feeds extends Controller
|
||||
$form_definitions = [];
|
||||
foreach ($feeds as $feed) {
|
||||
$md5 = md5($feed->getUrl());
|
||||
$form_definitions[] = [$md5 . '-url', TextType::class, ['data' => $feed->getUrl(), 'label' => ' ']];
|
||||
$form_definitions[] = [$md5 . '-order', IntegerType::class, ['data' => $feed->getOrdering(), 'label' => ' ']];
|
||||
$form_definitions[] = [$md5 . '-title', TextType::class, ['data' => $feed->getTitle(), 'label' => ' ']];
|
||||
$form_definitions[] = [$md5 . '-remove', SubmitType::class, ['label' => _m('Remove')]];
|
||||
$form_definitions[] = [$md5 . '-url', TextType::class, ['data' => $feed->getUrl(), 'label' => _m('URL'), 'block_prefix' => 'row_url']];
|
||||
$form_definitions[] = [$md5 . '-order', IntegerType::class, ['data' => $feed->getOrdering(), 'label' => _m('Order'), 'block_prefix' => 'row_order']];
|
||||
$form_definitions[] = [$md5 . '-title', TextType::class, ['data' => $feed->getTitle(), 'label' => _m('Title'), 'block_prefix' => 'row_title']];
|
||||
$form_definitions[] = [$md5 . '-remove', SubmitType::class, ['label' => _m('Remove'), 'block_prefix' => 'row_remove']];
|
||||
}
|
||||
|
||||
$form_definitions[] = ['url', TextType::class, ['label' => _m('New feed'), 'required' => false]];
|
||||
@ -243,7 +243,7 @@ class Feeds extends Controller
|
||||
|
||||
return [
|
||||
'_template' => 'feeds/edit_feeds.html.twig',
|
||||
'form' => $form->createView(),
|
||||
'edit_feeds' => $form->createView(),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,40 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block stylesheets %}
|
||||
{{ parent() }}
|
||||
<link rel="stylesheet" href="{{ asset('assets/default_theme/css/pages/feeds.css') }}" type="text/css">
|
||||
{% endblock stylesheets %}
|
||||
|
||||
{% block body %}
|
||||
<div class="section-widget">
|
||||
{{ form(form) }}
|
||||
<div class="section-widget section-widget-padded">
|
||||
<form class="section-form">
|
||||
|
||||
<fieldset>
|
||||
<legend class="section-form-legend">{{ "Edit feed navigation links" | trans }}</legend>
|
||||
|
||||
{# Since the form is not separated into individual groups, this happened #}
|
||||
{{ form_start(edit_feeds) }}
|
||||
{% for child in edit_feeds.children %}
|
||||
{% if 'row_url' in child.vars.block_prefixes %}
|
||||
<div class="section-widget section-widget-padded">
|
||||
{{ form_label(child) }}
|
||||
{{ form_widget(child) }}
|
||||
{% elseif 'row_title' in child.vars.block_prefixes %}
|
||||
{{ form_label(child) }}
|
||||
{{ form_widget(child) }}
|
||||
{% elseif 'row_order' in child.vars.block_prefixes %}
|
||||
{{ form_label(child) }}
|
||||
{{ form_widget(child) }}
|
||||
{% elseif 'row_remove' in child.vars.block_prefixes %}
|
||||
{{ form_label(child) }}
|
||||
{{ form_widget(child) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ form_end(edit_feeds) }}
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user