summaryrefslogtreecommitdiffstats
path: root/fedora.module
blob: 3703b75363ed869e9f8ba21998ec6678bc32b794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
  // $Id$

  /**
   * Change content creation form to remove "title" field for FWN
   * beats. For that content type we will autocompute the results from
   * the issue and beat number provided through CCK.
   */

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;
}

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');
}