function nodeformsettings_set_default_to_all in Node and Comments Form Settings 7.3
Function to handle submit for setting default for all content types.
_state
Parameters
array $form:
1 string reference to 'nodeformsettings_set_default_to_all'
- _nodeformsettings_settings_form in includes/
settings_node.inc - Define all settings for nodes.
File
- ./
nodeformsettings.module, line 335
Code
function nodeformsettings_set_default_to_all($form, &$form_state) {
// Save the current form.
nodeformsettings_settings_submit($form, $form_state);
// Get current content type.
$type = $form_state['values']['type'];
$current_type_title = $form_state['values']['name'];
// Get values from current content types settings.
$variable = variable_get("nodeformsettings_" . $type);
// Get all the types.
$types = node_type_get_types();
// For each type, set the current content type values.
foreach ($types as $type => $content_type) {
variable_set("nodeformsettings_" . $type, $variable);
}
drupal_set_message(t('The content type !type has been updated.', array(
'!type' => '<em>' . $current_type_title . '</em>',
)));
drupal_goto('admin/structure/types');
}