summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Ziegler2006-08-29 12:15:04 (GMT)
committer Wolfgang Ziegler2006-08-29 12:15:04 (GMT)
commit1b79852e6a3c221499288550af67278d55f884d7 (patch)
tree03009b25a9c127b1e55133df6949ee943a8500a0
parent7b700c64aaf8bc9a08908ff8f25a8100e90f3cb9 (diff)
obey setting correctly
-rw-r--r--auto_nodetitle.module12
1 files changed, 7 insertions, 5 deletions
diff --git a/auto_nodetitle.module b/auto_nodetitle.module
index f79e01b..1daf265 100644
--- a/auto_nodetitle.module
+++ b/auto_nodetitle.module
@@ -32,10 +32,12 @@ function auto_nodetitle_form_alter($form_id, &$form) {
}
else if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
//this is a node form
- $types = node_get_types();
- //node id is only available for node updates
- $title = ($form['#node']->nid) ? t('%type %node-id', array('%type' => $types[$form['type']['#value']], '%node-id' => $form['#node']->nid)) :
- t('%type', array('%type' => $types[$form['type']['#value']]));
- $form['title'] = array('#type' => 'value', '#value' => $title);
+ if (variable_get($form['type']['#value'] .'_auto_nodetitle', 0)) {
+ $types = node_get_types();
+ //node id is only available for node updates
+ $title = ($form['#node']->nid) ? t('%type %node-id', array('%type' => $types[$form['type']['#value']], '%node-id' => $form['#node']->nid)) :
+ t('%type', array('%type' => $types[$form['type']['#value']]));
+ $form['title'] = array('#type' => 'value', '#value' => $title);
+ }
}
} \ No newline at end of file