summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2010-10-17 16:20:01 -0400
committerPaul W. Frields <stickster@gmail.com>2010-10-17 16:20:01 -0400
commit889d9c49d3b1ca00862324ced5d96f96424eeb19 (patch)
tree8849d1280a38e2620c22a8e02e98d9d9ecb2d39a
parent736cdd001593a97711769a25c4d51355e9f0f18a (diff)
downloaddrupal-fedora-hooks-889d9c49d3b1ca00862324ced5d96f96424eeb19.zip
drupal-fedora-hooks-889d9c49d3b1ca00862324ced5d96f96424eeb19.tar.gz
drupal-fedora-hooks-889d9c49d3b1ca00862324ced5d96f96424eeb19.tar.xz
Fix computed title function for FWN beat content
-rw-r--r--fedora.module16
1 files 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');
}