基本的なフィールドセット テンプレートを作成しようとしています。私が持っているのはこれです:
fieldset.html.twig
{% form_theme form _self %}
{% block form_row %}
<fieldset>
<legend></legend>
{{ form_row(form) }}
</fieldset>
{% endblock %}
FieldsetType.php
class FieldsetType extends AbstractType
{
public function __construct($tituloFieldset="")
{
$this->titulo = $tituloFieldset;
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'attr' => array(
'title'=>$this->titulo
),
'mapped'=>false
));
}
public function getParent()
{
return 'form';
}
public function getName()
{
return 'fieldset';
}
private $titulo;
}
現在の使用状況
$builder->add('nestedform', new FieldsetType('legend'));
私はすべてを試しました:タイトルをラベルとして追加する(フィールドレンダリングのない追加のラベル)、フォーム全体をテンプレート化する(この場合、追加のフィールドセットを追加できません)など。
私は何をすべきか?