Type |
diff --git a/Resources/views/Form/fields.html.twig b/Resources/views/Form/fields.html.twig
index 118397393..a901512f9 100644
--- a/Resources/views/Form/fields.html.twig
+++ b/Resources/views/Form/fields.html.twig
@@ -1,3 +1,97 @@
{% block custom_field_title_widget %}
dump(attr)
-{% endblock custom_field_title_widget %}
\ No newline at end of file
+{# suggestion : {{ dump(form) }} to see all attributes from the form and pick the value or label #}
+{% endblock custom_field_title_widget %}
+
+
+{# render an alement in a choice list #}
+{% block cf_choices_list_widget %}
+
+{{ form_row(form.name) }}
+{{ form_row(form.active) }}
+{{ form_row(form.slug) }}
+
+{% endblock cf_choices_list_widget %}
+
+{# render the possibility to add different elements in a choice list #}
+{% block cf_choices_widget %}
+
+{{ form(form) }}
+
+
+{# we use javascrit to add an additional element. All functions are personnalized with the id ( = form.vars.id) #}
+
+
+{% endblock cf_choices_widget %}
+
+
+
+
+
+
+{% block choice_with_other_widget %}
+echo
+
+
+
+{%- for child in form.children._choices %}
+{%- if child.vars.value == '_other' -%}
+{{- form_widget(child) -}} {{- form_widget(form.children._other) -}}
+{%- else -%}
+{{- form_widget(child) -}}
+{{- form_label(child) -}}
+{%- endif -%}
+{% endfor -%}
+
+
+{% endblock choice_with_other_widget %}
\ No newline at end of file
diff --git a/Tests/Fixtures/App/app/AppKernel.php b/Tests/Fixtures/App/app/AppKernel.php
index 38d9f50fa..1f1941221 100644
--- a/Tests/Fixtures/App/app/AppKernel.php
+++ b/Tests/Fixtures/App/app/AppKernel.php
@@ -15,6 +15,7 @@ class AppKernel extends Kernel
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new \Chill\MainBundle\ChillMainBundle,
+ new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()
#add here all the required bundle (some bundle are not required)
);
}
diff --git a/Tests/Fixtures/App/app/Resources/views/CustomField/simple_form_render.html.twig b/Tests/Fixtures/App/app/Resources/views/CustomField/simple_form_render.html.twig
index 0c2f33eee..0fe833294 100644
--- a/Tests/Fixtures/App/app/Resources/views/CustomField/simple_form_render.html.twig
+++ b/Tests/Fixtures/App/app/Resources/views/CustomField/simple_form_render.html.twig
@@ -1,3 +1,7 @@
+{% if inputKeys is defined %}
{% for key in inputKeys %}
- {{ form_row(form[key]) }}
+{{ form_row(form[key]) }}
{% endfor %}
+{% else %}
+{{ form(form) }}
+{% endif %}
diff --git a/Tests/Fixtures/App/app/Resources/views/base.html.twig b/Tests/Fixtures/App/app/Resources/views/base.html.twig
index bafd28d3b..a40ea56af 100644
--- a/Tests/Fixtures/App/app/Resources/views/base.html.twig
+++ b/Tests/Fixtures/App/app/Resources/views/base.html.twig
@@ -5,6 +5,7 @@
{% block title %}Welcome!{% endblock %}
{% block stylesheets %}{% endblock %}
+ {% block javascripts_head %}{% endblock %}
{% block body %}{% endblock %}
diff --git a/Tests/Fixtures/App/app/config/config.yml b/Tests/Fixtures/App/app/config/config.yml
index 68250de45..30e547831 100644
--- a/Tests/Fixtures/App/app/config/config.yml
+++ b/Tests/Fixtures/App/app/config/config.yml
@@ -27,4 +27,41 @@ doctrine:
auto_mapping: true
chill_main:
- available_languages: [ fr, nl, en ]
\ No newline at end of file
+ available_languages: [ fr, nl, en ]
+
+security:
+ providers:
+ chain_provider:
+ chain :
+ providers: [in_memory, users]
+ in_memory:
+ memory:
+ users:
+ admin: { password: olala, roles: 'ROLE_ADMIN' }
+ users:
+ entity:
+ class: Chill\MainBundle\Entity\User
+ property: username
+
+ encoders:
+ Chill\MainBundle\Entity\User:
+ algorithm: bcrypt
+ Symfony\Component\Security\Core\User\User: plaintext
+
+ firewalls:
+ dev:
+ pattern: ^/(_(profiler|wdt)|css|images|js)/
+ security: false
+
+ default:
+ anonymous: ~
+ form_login:
+ csrf_parameter: _csrf_token
+ intention: authenticate
+ csrf_provider: form.csrf_provider
+ logout: ~
+ access_control:
+ #disable authentication for tests
+ #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+ #- { path: ^/admin, roles: ROLE_ADMIN }
+ #- { path: ^/, roles: ROLE_USER }
\ No newline at end of file
diff --git a/Tests/Fixtures/App/app/config/config_dev.yml b/Tests/Fixtures/App/app/config/config_dev.yml
index 81e0f80f4..96f5a2a43 100644
--- a/Tests/Fixtures/App/app/config/config_dev.yml
+++ b/Tests/Fixtures/App/app/config/config_dev.yml
@@ -4,4 +4,8 @@ imports:
framework:
test: ~
session:
- storage_id: session.storage.filesystem
\ No newline at end of file
+ storage_id: session.storage.filesystem
+
+chill_custom_fields:
+ customizables_entities:
+ - { class: TEST, name: test }
\ No newline at end of file
diff --git a/Tests/Fixtures/App/app/config/routing.yml b/Tests/Fixtures/App/app/config/routing.yml
index 13acf8d6f..7698f5065 100644
--- a/Tests/Fixtures/App/app/config/routing.yml
+++ b/Tests/Fixtures/App/app/config/routing.yml
@@ -2,3 +2,6 @@ cl_custom_fields:
resource: .
type: chill_routes
+test_custom_field_form_render:
+ path: /customfieldsgroup/test/render/{id}
+ defaults: { _controller: ChillCustomFieldsBundle:CustomFieldsGroup:renderForm }
\ No newline at end of file
diff --git a/composer.json b/composer.json
index f9468aa09..0f7dc365e 100644
--- a/composer.json
+++ b/composer.json
@@ -39,5 +39,8 @@
},
"extra": {
"symfony-app-dir": "Tests/Fixtures/App/app"
+ },
+ "require-dev": {
+ "doctrine/doctrine-fixtures-bundle": "~2.2@dev"
}
}