I'm creating a dynamic form in Silex that alters depending on need.
If $disabled = 'true'
How would I change:
$form = $app['form.factory']->createBuilder('form')
->add('email', 'email', array(
'data' => $from
))
to
$form = $app['form.factory']->createBuilder('form')
->add('email', 'email', array(
'disabled' => true,
'data' => $from
))
trueas a boolean value and 'true' as a string. You seem to use both, which is a way to fail somewhere. And the answer below also compares potentially boolean value with string, which is wrong.