I want to add an array condition in input field. if flag == 1
then it is a required field otherwise it is not required field
<?php echo $this->Form->input('course_workbook_answer_file', array(
'type' => 'file',
'label' => false,
'id' => 'course_workbook_answer_file',
'class' => 'form-control',
'name' => 'data[CourseWorkbook][0][course_workbook_answer_file]',
$port_flag == 0 ? 'required' => 'required' : Null
)); ?>