Drupal tip: 'node_type_form' saves extra values by itself

If you extend a node_type_form with a few fields of your own, you don't need to write a submit function or other code to save the values. All 'unknown' values are saved by node_type_form_submit in the variables table. The name is always your form element name followed by _nameofcontenttype.

For example you have 2 content types: 'page' en 'video'. And a function to extend the node_type_form::

<?php
function custom_form_node_type_form_alter() {
  $form['custom_value'] = array(
    '#type' => 'textbox',
    '#title' => t('Some custom value'),
    '#default_value' => variable_get('custom_value_'. $form['#node_type']->type, ''),
  );
}
?>
 
You dont need a submit function to save the custom_value. Drupal will automaticly save als custom_value_page and custom_value_video respectivly.