Permalink
Browse files

bug #4103 [Cookbook][Forms] fix PHP template file name (xabbuh)

This PR was merged into the 2.3 branch.

Discussion
----------

[Cookbook][Forms] fix PHP template file name

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | part of #4088

Commits
-------

6a14650 [Cookbook][Forms] fix PHP template file name
  • Loading branch information...
weaverryan committed Aug 8, 2014
2 parents 234fa36 + 6a14650 commit 3ffc20fcee21b3df5b16e7d270634ac4e682d163
Showing with 48 additions and 1 deletion.
  1. +48 −1 cookbook/form/create_custom_field_type.rst
@@ -129,7 +129,7 @@ link for details), create a ``gender_widget`` block to handle this:
.. code-block:: html+php
<!-- src/Acme/DemoBundle/Resources/views/Form/gender_widget.html.twig -->
<!-- src/Acme/DemoBundle/Resources/views/Form/gender_widget.html.php -->
<?php if ($expanded) : ?>
<ul <?php $view['form']->block($form, 'widget_container_attributes') ?>>
<?php foreach ($form as $child) : ?>
@@ -151,6 +151,8 @@ link for details), create a ``gender_widget`` block to handle this:
Further, the main config file should point to the custom form template
so that it's used when rendering all forms.
When using Twig this is:
.. configuration-block::
.. code-block:: yaml
@@ -181,6 +183,51 @@ link for details), create a ``gender_widget`` block to handle this:
),
));
For the PHP templating engine, your configuration should look like this:
.. configuration-block::
.. code-block:: yaml
# app/config/config.yml
framework:
templating:
form:
resources:
- 'AcmeDemoBundle:Form'
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:templating>
<framework:form>
<framework:resource>AcmeDemoBundle:Form</twig:resource>
</framework:form>
</framework:templating>
</framework:config>
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('framework', array(
'templating' => array(
'form' => array(
'resources' => array(
'AcmeDemoBundle:Form',
),
),
),
));
Using the Field Type
--------------------

0 comments on commit 3ffc20f

Please sign in to comment.