Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TwigBridge] Handle form label attributes like others
- Loading branch information
Showing
6 changed files
with
20 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
<?php echo $view['form']->block($form, 'widget_attributes') ?> | ||
<?php foreach ($attr as $k => $v): ?> | ||
<?php if ('placeholder' === $k || 'title' === $k): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?> | ||
<?php elseif (true === $v): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?> | ||
<?php elseif (false !== $v): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($v)) ?> | ||
<?php endif ?> | ||
<?php endforeach ?> |
12 changes: 2 additions & 10 deletions
12
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_attributes.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>" <?php if ($disabled): ?>disabled="disabled" <?php endif ?> | ||
<?php foreach ($attr as $k => $v): ?> | ||
<?php if (in_array($k, array('placeholder', 'title'), true)): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?> | ||
<?php elseif ($v === true): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?> | ||
<?php elseif ($v !== false): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($v)) ?> | ||
<?php endif ?> | ||
<?php endforeach ?> | ||
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"<?php if ($disabled): ?> disabled="disabled"<?php endif ?> | ||
<?php echo $attr ? ' '.$view['form']->block($form, 'attributes') : '' ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 1 addition & 9 deletions
10
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
id="<?php echo $view->escape($id) ?>" name="<?php echo $view->escape($full_name) ?>"<?php if ($disabled): ?> disabled="disabled"<?php endif ?> | ||
<?php if ($required): ?> required="required"<?php endif ?> | ||
<?php foreach ($attr as $k => $v): ?> | ||
<?php if (in_array($k, array('placeholder', 'title'), true)): ?> | ||
<?php printf(' %s="%s"', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?> | ||
<?php elseif ($v === true): ?> | ||
<?php printf(' %s="%s"', $view->escape($k), $view->escape($k)) ?> | ||
<?php elseif ($v !== false): ?> | ||
<?php printf(' %s="%s"', $view->escape($k), $view->escape($v)) ?> | ||
<?php endif ?> | ||
<?php endforeach ?> | ||
<?php echo $attr ? ' '.$view['form']->block($form, 'attributes') : '' ?> |
12 changes: 2 additions & 10 deletions
12
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_container_attributes.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>" <?php endif ?> | ||
<?php foreach ($attr as $k => $v): ?> | ||
<?php if (in_array($k, array('placeholder', 'title'), true)): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape(false !== $translation_domain ? $view['translator']->trans($v, array(), $translation_domain) : $v)) ?> | ||
<?php elseif ($v === true): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($k)) ?> | ||
<?php elseif ($v !== false): ?> | ||
<?php printf('%s="%s" ', $view->escape($k), $view->escape($v)) ?> | ||
<?php endif ?> | ||
<?php endforeach ?> | ||
<?php if (!empty($id)): ?>id="<?php echo $view->escape($id) ?>"<?php endif ?> | ||
<?php echo $attr ? ' '.$view['form']->block($form, 'attributes') : '' ?> |