function publish_button_form_alter in Publish button 7
Implements hook_form_alter().
Here we have both the settings for which content types that would have the button and the button itself.
File
- ./
publish_button.module, line 37 - Functions to create a publish button. Real simple, but could be needed.
Code
function publish_button_form_alter(&$form, &$form_state, $form_id) {
// Add settings for using content type on types/manage/my_content_type
if ($form_id == 'node_type_form') {
// After that a checkbox for settings.
$form['workflow']['publish_button_content_type'] = array(
'#type' => 'checkbox',
'#title' => t('Use publish/unpublish button for this content type'),
// Getting/setting the variable that contains the setting for the content
// type.
'#default_value' => variable_get('publish_button_content_type_' . $form['#node_type']->type, FALSE),
);
}
}