Skip to content

Commit

Permalink
Merge branch '1.x' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jun 23, 2023
2 parents 8f647b1 + 30e814e commit 702cb42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 1 addition & 11 deletions docs/reference/form_types.rst
Expand Up @@ -237,17 +237,7 @@ They will allow you to have a JS date picker onto your form fields as follows:

.. image:: ../images/datepicker.png

In order to use them, you'll need to perform a bit of setup:

.. code-block:: yaml
# config/packages/twig.yaml
twig:
form_themes:
- '@SonataForm/Form/datepicker.html.twig'
Finally, in your form, you may use the form type as follows::
In your form, you may use the form type as follows::

// src/Admin/PageAdmin.php

Expand Down
Expand Up @@ -37,6 +37,13 @@ public function prepend(ContainerBuilder $container): void
);
}
}

// add custom form widgets
if ($container->hasExtension('twig')) {
$container->prependExtensionConfig('twig', [
'form_themes' => ['@SonataForm/Form/datepicker.html.twig'],
]);
}
}

public function load(array $configs, ContainerBuilder $container): void
Expand Down

0 comments on commit 702cb42

Please sign in to comment.