{% extends "account/base.html.twig" %} {% block title %} {{ "new client application" | trans }} {% endblock %} {% set selected = "" %} {# form input macro #} {% macro input(name, value, violations, property, class="", type, size) %} {% if violations is none %} {% else %} {% set hasError = "false" %} {% for violation in violations %} {% if violation.getPropertyPath == property and hasError == "false" %} {% set hasError = "true" %} {{ violation.getInvalidValue }} - {{violation.getMessage}} {% endif %} {% endfor %} {% if hasError == "false" %} {% endif %} {% endif %} {% endmacro %} {# form textare macro #} {% macro textarea(name, value, violations,property, rows, cols, class="") %} {% if violations is none %} {% else %} {% set hasError = "false" %} {% for violation in violations %} {% if violation.getPropertyPath == property and hasError == "false" %} {% set hasError = "true" %} {{violation.getMessage}} {% endif %} {% endfor %} {% if hasError == "false" %} {% endif %} {% endif %} {% endmacro %} {% block content_account %}
{% if form is none %} {% set name, description, website, callback = "", "", "", "" %} {% set app_type = "web" %} {% else %} {% set name = form.name %} {% set description = form.description %} {% set website = form.website %} {% set callback = form.callback %} {% set app_type = form.type %} {% endif %}
{{ _self.input("name", name, violations, "name", "input-xlarge") }}
{{ _self.textarea("description", description, violations, "description", 5, 30, "input-xlarge") }}
{{ _self.input("website", website, violations, "urlwebsite") }}
{% if app_type == "web" %}
{{ _self.input("callback", callback, violations, "urlcallback") }}
{% endif %}
{% endblock %}