From 889d9c49d3b1ca00862324ced5d96f96424eeb19 Mon Sep 17 00:00:00 2001 From: "Paul W. Frields" Date: Sun, 17 Oct 2010 16:20:01 -0400 Subject: Fix computed title function for FWN beat content --- fedora.module | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fedora.module b/fedora.module index 3703b75..9c8373e 100644 --- a/fedora.module +++ b/fedora.module @@ -8,17 +8,19 @@ */ function fedora_fwnbeat_node_form_validate($form, &$form_state) { - $newtitle = 'FWN ' . $form['field_issue']['#value'] . ' ' . $form['field_beat']['#value']; - $form_set_value($form['title'], $newtitle, &$form_state); - $form_state['rebuild'] = TRUE; - drupal_set_message('Created beat with title '.$newtitle); - return TRUE; + /** + * This function does not do pure validation, but rather performs + * the specific function of computing the value of a new node title + * from a given FWN issue and beat. + */ + $newtitle = 'FWN ' . $form_state['values']['field_issue'][0]['value'] . ' - ' . $form_state['values']['field_beat'][0]['value']; + form_set_value($form['title'], $newtitle, $form_state); } function fedora_form_fwnbeat_node_form_alter(&$form, $form_state) { // In the FWN beat content entry form, remove the title field $form['title']['#type'] = 'hidden'; $form['title']['#value'] = NULL; - $oldval = $form['#validate']; - $form['#validate'] = array_unshift($oldval, 'fedora_fwnbeat_node_form_validate'); + // array_unshift() puts our custom validation function at the top. + array_unshift($form['#validate'], 'fedora_fwnbeat_node_form_validate'); } -- cgit