mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
add model + form to handle alt names
This commit is contained in:
@@ -34,6 +34,8 @@ use Chill\MainBundle\Form\Type\Select2CountryType;
|
||||
use Chill\MainBundle\Form\Type\Select2LanguageType;
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
||||
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
|
||||
class PersonType extends AbstractType
|
||||
{
|
||||
@@ -46,14 +48,23 @@ class PersonType extends AbstractType
|
||||
* @var string[]
|
||||
*/
|
||||
protected $config = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @var ConfigPersonAltNamesHelper
|
||||
*/
|
||||
protected $configAltNamesHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string[] $personFieldsConfiguration configuration of visibility of some fields
|
||||
*/
|
||||
public function __construct(array $personFieldsConfiguration)
|
||||
{
|
||||
public function __construct(
|
||||
array $personFieldsConfiguration,
|
||||
ConfigPersonAltNamesHelper $configAltNamesHelper
|
||||
) {
|
||||
$this->config = $personFieldsConfiguration;
|
||||
$this->configAltNamesHelper = $configAltNamesHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,6 +81,12 @@ class PersonType extends AbstractType
|
||||
'required' => true
|
||||
));
|
||||
|
||||
if ($this->configAltNamesHelper->hasAltNames()) {
|
||||
$builder->add('altNames', PersonAltNameType::class, [
|
||||
'by_reference' => false
|
||||
]);
|
||||
}
|
||||
|
||||
if ($this->config['memo'] === 'visible') {
|
||||
$builder
|
||||
->add('memo', TextareaType::class, array('required' => false))
|
||||
|
Reference in New Issue
Block a user