Last active
December 24, 2015 10:29
-
-
Save jmolivas/6784640 to your computer and use it in GitHub Desktop.
Override date & time inputs more info: How to customize Form Rendering - http://symfony.com/doc/current/cookbook/form/form_customization.html
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
{# File path: YourBundle / Resources / views / Form / fields.html.twig #} | |
{% block form_widget_simple %} | |
{% spaceless %} | |
{% set type = type|default('text') in ['date','time'] ? 'text' : type|default('text') %} | |
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/> | |
{% endspaceless %} | |
{% endblock form_widget_simple %} | |
{# How to use: #} | |
# 1 Apply on a single Twig | |
{% form_theme form 'MytechdeskBundle:Form:fields.html.twig' %} | |
# 2 Making Application-wide Customizations¶ | |
# app/config/config.yml | |
twig: | |
form: | |
resources: | |
- 'AcmeDemoBundle:Form:fields.html.twig' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment