Form Types
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', [
'label' => 'I have seen the <a href="%team%">Team</a> and <a href="%more%">More</a> pages ...',
'content_ids' => [
'%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.