Friday, September 18, 2009

Set Content Type Node Title to a default value

Method 1: Use Automatic Nodetitles module

Method 2: hook_form_alter()

<?php
/**
* Implementation of hook_form_alter().
*/
function YourModuleName_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && isset($form['#node'])) {
    if ($form_id === 'your_content_type_name_node_form') {
      $form['title']['#default_value'] = 'asdf';
      //$form['title']['#value'] = 'asdf';
      $form['title']['#required'] = FALSE;
    }
  }

}
?>
Try to Clear Cache if things don't work.

1 comment:

Anonymous said...

You may be also interested in the sql server database repair program, it automatically fixes corrupted database files