Commit 98584163 authored by Igor Biki's avatar Igor Biki
Browse files

ISTWCMS-5183: Adding #states for opportunities in form alter hook.

parent 06cb77d7
......@@ -28,9 +28,12 @@ function uw_ct_opportunities_form_alter(array &$form, FormStateInterface $form_s
// Rate of pay and Rate of pay type fields show,
// and also Rate of pay type shows as required field.
foreach ($opportunity_type_show_payment_tids as $opportunity_type_show_payment_tid) {
$form['field_uw_opportunity_pay_rate']['#states']['visible'][':input[name="field_uw_opportunity_type"]']['value'] = $opportunity_type_show_payment_tid;
//$form['field_uw_opportunity_pay_type']['widget']['#required'] = TRUE;
$form['field_uw_opportunity_pay_type']['#states']['visible'][':input[name="field_uw_opportunity_type"]']['value'] = $opportunity_type_show_payment_tid;
$form['field_uw_opportunity_pay_type']['widget']['#required'] = TRUE;
$form['field_uw_opportunity_pay_type']['widget']['#states']['required'][':input[name="field_uw_opportunity_type"]']['value'] = $opportunity_type_show_payment_tid;
$form['field_uw_opportunity_pay_rate']['#states']['visible'][':input[name="field_uw_opportunity_type"]']['value'] = $opportunity_type_show_payment_tid;
$form['field_uw_opportunity_pay_rate']['widget'][0]['value']['#states']['required'][':input[name="field_uw_opportunity_type"]']['value'] = $opportunity_type_show_payment_tid;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment