Hello,
This is my firts attempt at writing code for a special need I have. I could use some help.
The issue: I have created a contenttype (Machine name: clubwedstrijd) via the core functions in Drupal 7. I now need to set a default value for the title of the content type.
As I could not find easily how to configure this, and as I wanted to get some first experience with writing a (small module), I gave it a go. I looked at the doc, and thought I could use the hook_form_FORM_ID_alter. I used the example they gave to start from. But, It does not work. Here is what I did
module: default_title
//function hook_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
function default_title_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
// Modification for the form with the given form ID goes here. For example, if
// FORM_ID is "user_register" this code would run only on the user
// registration form.
IF (form_id=='clubwedstrijd') {
// Add a default value
$form['title'] = array(
'#default_value' => 'enter club number',
);
}
}
I also made a .info file
name = Default Title
description = Adds a default title to a given node type
package = Default Title
core = 7.x