{# This is an extension of Twig Form Theme #}
{# We redefine form elements, so they are binded with Angular model #}
{% extends "MopaBootstrapBundle:Form:fields.html.twig" %}
{# Make data available to current scope as $scope.data - will not work with hidden fields #}
{% block widget_attributes %}
{% spaceless %}
{% if attr['ng-model'] is not defined %}
{% if attr['checklist-model'] is not defined %}
{% set attr = attr | merge({ 'ng-model': full_name | ngmodel }) %}
{% endif %}
{% elseif attr['ng-model'] is same as(true) %}
{% set attr = attr | merge({ 'ng-model': full_name | ngmodel ~ '.id' }) %}
{% endif %}
id="{{ id }}" name="{{ full_name }}"{% if read_only %} readonly="readonly"{% endif %}{% if disabled %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif %}
{% for attrname, attrvalue in attr %}{% if attrname in ['placeholder', 'title'] %}{{ attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {% else %}{{ attrname }}="{{ attrvalue }}" {% endif %}{% endfor %}
{# {% if attr['ng-init'] is not defined %}ng-init="{{ 'if (' ~ attr['ng-model'] ~ ' === undefined)' ~ attr['ng-model'] ~ '="' ~ value ~ '"' }}"{% endif %} #}{# Angular ng-init #}
{% endspaceless %}
{% endblock widget_attributes %}
{# Current controller submit() will called, instead of submitting the form #}
{#}
{% block form_start %}
{% spaceless %}
{% set method = method|upper %}
{% if method in ["GET", "POST"] %}
{% set form_method = method %}
{% else %}
{% set form_method = "POST" %}
{% endif %}