Commit 98f4278f authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5214: adding status to node add/edit

parent 9cefca09
......@@ -15,12 +15,42 @@ function uw_ct_opportunities_form_alter(array &$form, FormStateInterface $form_s
// Modify help text of Contact for additional information field.
$form['field_uw_opportunity_contact']['widget'][0]['uri']['#description'] = t('You can also enter an internal path such as <em>/blog</em>, an email link such as <em>mailto:email@example.com</em>, or an external URL such as <em>https://example.com</em>.');
// Add ajax function for showing Rate of pay and Rate of pay rate
// when selecting opportunity type has show payment field checked.
$form['field_uw_opportunity_type']['widget']['#ajax'] = [
'callback' => '_uw_ct_opportunities_node_form_callback',
'event' => 'change',
'wrapper' => $form['#id'],
// Get the terms for the rate of pay.
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree('uw_vocab_opportunity_type');
// Get the tid for Paid rate of pay.
foreach ($terms as $term) {
if ($term->name == 'Paid') {
$tid = $term->tid;
break;
}
}
// Set the states for employment type.
$form['field_uw_opportunity_employment']['#states'] = [
'visible' => [
'select[name="field_uw_opportunity_type"]' => ['value' => $tid],
],
'required' => [
'select[name="field_uw_opportunity_type"]' => ['value' => $tid],
],
];
// Set the states for the pay rate.
$form['field_uw_opportunity_pay_rate']['#states'] = [
'visible' => [
'select[name="field_uw_opportunity_type"]' => ['value' => $tid],
],
];
// Set the states for the pay type.
$form['field_uw_opportunity_pay_type']['#states'] = [
'visible' => [
'select[name="field_uw_opportunity_type"]' => ['value' => $tid],
],
'required' => [
'select[name="field_uw_opportunity_type"]' => ['value' => $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