Skip to content

Commit

Permalink
Merge pull request #22 from anthofremion/namespaced-twig-paths
Browse files Browse the repository at this point in the history
Use namespaced twig paths
  • Loading branch information
nervo authored Nov 8, 2018
2 parents ded9e0a + b757286 commit c0bf152
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ Use the provided form template, globally:
# Twig Configuration
twig:
form_themes:
- "ElaoFormBundle:Form:form_elao_layout.html.twig"
- "@ElaoForm/Form/form_elao_layout.html.twig"
```
Or on a specific form:
``` twig
{% form_theme form 'ElaoFormBundle:Form:form_elao_layout.html.twig' %}
{% form_theme form '@ElaoForm/Form/form_elao_layout.html.twig' %}
```

## Features:
Expand Down Expand Up @@ -73,4 +73,3 @@ Provide sortcut for adding submit and reset buttons:
All form have now an optional option "submit" and "reset", setting it to true adds a default submit/reset button

$form = $this->createForm(PostType::class, $post, array('submit' => true, 'reset' => true));

12 changes: 6 additions & 6 deletions Resources/views/Form/form_elao_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
{% endblock form_row %}

{% block row_container_attributes %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% spaceless %}
{% set group_class = group_class|default('group') %}
{% set group_attr = group_attr|default({})|merge({'class': (group_attr.class|default('') ~ ' ' ~ group_class)|trim }) %}
Expand All @@ -74,14 +74,14 @@
{% block group_id id ~ '-group' %}

{% block control_group_attributes %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% spaceless %}
{{ macros.html_attributes(control_group_attr) }}
{% endspaceless %}
{% endblock control_group_attributes %}

{% block label_group_attributes %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% spaceless %}
{{ macros.html_attributes(label_group_attr) }}
{% endspaceless %}
Expand All @@ -90,7 +90,7 @@
{# Form label #}

{% block form_label %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% spaceless %}
{% set label_attr = label_attr|default({})|merge({'class': (label_attr.class|default('') ~ ' ' ~ label_class|default('label'))|trim}) %}
{% if label is not same as(false) %}
Expand Down Expand Up @@ -239,7 +239,7 @@
{% endblock %}

{% block choice_widget_options_attributes %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% set choice_attr = choice.attr|default({})|merge({value: choice.value}) %}

{% if choice is selectedchoice(value) %}
Expand Down Expand Up @@ -337,7 +337,7 @@
{% endblock collection_button %}

{% block collection_button_attributes %}
{% import "ElaoFormBundle:Form:macros.html.twig" as macros %}
{% import "@ElaoForm/Form/macros.html.twig" as macros %}
{% spaceless %}
{% set button_attr = button_attr|default({})|merge({id: block('collection_' ~ button_function ~ '_button_id')}) %}
{% set button_attr = button_attr|default({})|merge({type: 'button'}) %}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}
],
"require": {
"symfony/framework-bundle": "~2.8|~3.0",
"symfony/form": "~2.8|~3.0"
"symfony/form": "~2.8|~3.0",
"symfony/twig-bridge": "~2.8|~3.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit c0bf152

Please sign in to comment.