Commit 9c025975 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5210: removing unused functions

parent aa737dab
......@@ -49,45 +49,3 @@ function uw_ct_opportunities_form_alter(array &$form, FormStateInterface $form_s
}
}
/**
* Ajax callback function.
*/
function _uw_ct_opportunities_node_form_callback(array &$form, FormStateInterface $form_state): array {
// Get the tid value from opportunity type field.
$opportunity_type_selected = $form_state->getValue('field_uw_opportunity_type');
// Get the tids from uw_vocab_opportunity_type
// which show payment field is checked.
$opportunity_type_show_payment_tids = _uw_ct_opportunities_get_terms('uw_vocab_opportunity_type');
// Two fields (Rate of pay and Rate of pay type) only visible
// when selected opportunity type has "show payment fields" checked.
if (!(in_array($opportunity_type_selected[0]['target_id'], $opportunity_type_show_payment_tids))) {
unset($form['field_uw_opportunity_pay_rate']);
unset($form['field_uw_opportunity_pay_type']);
}
return $form;
}
/**
* The help function to get tids from vid.
*/
function _uw_ct_opportunities_get_terms($vid) {
// Get taxonomy term objects from vid.
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid);
foreach ($terms as $term) {
// Load each tid to get term object.
$term_obj = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($term->tid);
// Get the value of field_uw_opportunity_type_show.
// 1 means checked, 0 means un-checked.
$show_payment = $term_obj->get('field_uw_opportunity_type_show')->getvalue();
// Get tids when field_uw_opportunity_type_show is checked.
if ($show_payment[0]['value'] == 1) {
$tids[] = $term->tid;
}
}
return $tids;
}
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