Skip to content

Commit da2f6fe

Browse files
committed
[Form] Implemented support for buttons
1 parent fab2e8a commit da2f6fe

File tree

8 files changed

+30
-0
lines changed

8 files changed

+30
-0
lines changed

Resources/config/form.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@
140140
<service id="form.type.url" class="Symfony\Component\Form\Extension\Core\Type\UrlType">
141141
<tag name="form.type" alias="url" />
142142
</service>
143+
<service id="form.type.button" class="Symfony\Component\Form\Extension\Core\Type\ButtonType">
144+
<tag name="form.type" alias="button" />
145+
</service>
146+
<service id="form.type.submit" class="Symfony\Component\Form\Extension\Core\Type\SubmitType">
147+
<tag name="form.type" alias="submit" />
148+
</service>
149+
<service id="form.type.reset" class="Symfony\Component\Form\Extension\Core\Type\ResetType">
150+
<tag name="form.type" alias="reset" />
151+
</service>
143152

144153
<!-- FormTypeHttpFoundationExtension -->
145154
<service id="form.type_extension.form.http_foundation" class="Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension">
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
id="<?php echo $view->escape($id) ?>"
2+
name="<?php echo $view->escape($full_name) ?>"
3+
<?php if ($disabled): ?>disabled="disabled" <?php endif ?>
4+
<?php foreach ($attr as $k => $v): ?>
5+
<?php printf('%s="%s" ', $view->escape($k), $view->escape($v)) ?>
6+
<?php endforeach; ?>

Resources/views/Form/button_label.html.php

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<?php echo $view['form']->widget($form) ?>
3+
</div>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php if (!$label) { $label = $view['form']->humanize($name); } ?>
2+
<button type="<?php echo isset($type) ? $view->escape($type) : 'button' ?>" <?php echo $view['form']->block($form, 'button_attributes') ?>>
3+
<?php $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?>
4+
</button>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<tr>
2+
<td></td>
3+
<td>
4+
<?php echo $view['form']->widget($form) ?>
5+
</td>
6+
</tr>

0 commit comments

Comments
 (0)