Alright, Gonna应诚实。 如同一些决定一样,Symfony决定用其核心档案处理,企图掩盖这些档案。 例如
Symfony/Component/Form/Extension/Core/Type/ FieldType.php
im 试图改变如果一个表态有父母一方,因为自己做一些冷却式铺设,就会出现的名字。
只是试图使其成为<代码>fullName和$id
。 两者均为<代码>form->getName();
public function buildView(FormView $view, FormInterface $form)
{
$name = $form->getName();
if ($view->hasParent()) {
$parentId = $view->getParent()->get( id );
$parentFullName = $view->getParent()->get( full_name );
// Custom Logic
//$id = sprintf( %s_%s , $parentId, $name);
//$fullName = sprintf( %s[%s] , $parentFullName, $name);
$id = $form->getName();
$fullName = $form->getName();
} else {
$id = $name;
$fullName = $name;
}
$types = array();
foreach ($form->getTypes() as $type) {
$types[] = $type->getName();
}
$view
->set( form , $view)
->set( id , $id)
->set( name , $name)
->set( full_name , $fullName)
->set( errors , $form->getErrors())
->set( value , $form->getClientData())
->set( read_only , $form->isReadOnly())
->set( required , $form->isRequired())
->set( max_length , $form->getAttribute( max_length ))
->set( pattern , $form->getAttribute( pattern ))
->set( size , null)
->set( label , $form->getAttribute( label ))
->set( multipart , false)
->set( attr , $form->getAttribute( attr ))
->set( types , $types)
;
}