Is it possible without touching Dupal core's code, add some configuration option to content type edit page? preferably to vertical tabs of bottom? such as a checkbox.
I mean this page: /admin/structure/types/manage/article
Yes, you can add a fieldset to the content type edit form with hook_form_FORM_ID_alter.
e.g:
function MYMODULE_form_node_type_form_alter(&$form, &$form_state) {
// Define field set in additional settings group
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => 10,
'#group' => 'additional_settings',
);
// Add checkbox option
$form['advanced']['special_option'] = array(
'#type' => 'checkbox',
'#title' => t('Use special option'),
);
// Set default value from automatically saved config variable
$form['advanced']['special_option']['#default_value'] = variable_get('special_option_' . $form['#node']->type, 1);
}
$form['#node_type']->type
is more $form['#node']->type
or $form['type']['#value']
or $form['#bundle']
...
Ok I found the answer: seems to be needed to add a submit function to your $form, to set the variable to store.
In the MYMODULE_form_node_form_alter() function, add:
$form['#submit'][] = 'MYMODULE_node_form_submit';
then the submit function:
function userprog_node_form_submit ($form, &$form_state) {
$special = $form_state['values']['special_option'];
variable_set('MYMODULE_' . $form_state['values']['type'] . '_special_option', $special);
}
NB: the variable_get() in the hook_form_alter() function, becomes:
// Set default value from automatically saved config variable
$form['advanced']['special_option']['#default_value'] = variable_get('MYMODULE_' . $form['#node_type']->type . '_special_option', 1);
You could also have a look at the nodeapi_example module. (From the Drupal Example modules).
It gives a quite legible example on adding a setting to the content type edit page AND an extra 'setting'/option to every node for which it is enabled.