English spoken conference

Symfony 5: The Fast Track

A new book to learn about developing modern Symfony 5 applications.

Support this project

WARNING: You are browsing the documentation for version 1.1 which is not maintained anymore. If some of your projects are still using this version, consider upgrading.

Form Types provided by the CoreBundle

1.1 version
Maintained Unmaintained

Form Types provided by the CoreBundle

Checkbox URL Label

The form type cmf_core_checkbox_url_label is based on the checkbox type and adds features useful for the classical "accept terms" check. The difference to a normal checkbox is that the label is linked to a document, typically a "terms and conditions" document. When using this type, you additionally specify content_ids, which are understood by the DynamicRouter, along with replacement tokens:

1
2
3
4
5
6
7
$form->add('terms', 'cmf_core_checkbox_url_label', array(
    'label' => 'I have seen the <a href="%team%">Team</a> and <a href="%more%">More</a> pages ...',
    'content_ids' => array(
        '%team%' => '/cms/content/static/team',
        '%more%' => '/cms/content/static/more',
    ),
));

The form type automatically generates the routes for the specified content and passes the routes to the trans Twig helper for replacement in the label.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.