I try to make an if-statement inside an array:
$formBuilder->add('getTimestamp', DateType::class, array(
'widget' => 'single_text',
if($target == "new"){
'data' => new \DateTime(),
}
'attr' => array('class' => 'form-control', 'style' => 'line-height: 20px;'), 'label' => $field['fieldName'],
));
But I get an error message
(1/1) ParseError
syntax error, unexpected 'if' (T_IF), expecting ')'
Aucun commentaire:
Enregistrer un commentaire