What is the correct way to programatically set node type options? I learned yesterday that the correct way to create a node type is by implementing hook_node_info inside a .module file. Before I had been programatically creating node types in a .install file via node_type_save, like this:

// Create node type
$type = array(
  'type' =&gt; 'fruits',
  'name' =&gt; st('Fruits'),
  'base' =&gt; 'node_content',
  'description' =&gt; 'Contains information about fruits.',
  'custom' =&gt; 1,
  'modified' =&gt; 1,
  'locked' =&gt; 0,
);
$type = node_type_set_defaults($type);
node_type_save($type);


I had also been setting the node type options in the .install file, like this:

// Set 'fruit' options.
variable_set('node_preview_fruit', 0);                     // Set 'Preview before submitting' to 'Disabled'.
variable_set('node_options_fruit', array('status'));       // Set 'Default options' to 'Published'.
variable_set('node_submitted_fruit', 0);                   // Unset 'Display author and date information'.
variable_set('comment_fruit', COMMENT_NODE_CLOSED);        // Set 'Default comment setting for new content' to 'Closed'.
variable_set('menu_options_fruit', array('navigation'));   // Set 'Available menus' to 'Navigation'.
variable_set('menu_parent_fruit', 'navigation:0');         // Set 'Default parent item' to '&lt;Navigation&gt;'.


Is this the correct way to programatically set node type options: like this, inside the .install file, even though the node type itself is created inside the .module file?
Looking at the code for node_type_form_submit you can see that the variables are set before the node_type_save() function is called. Thinking about it a bit, it doesn't really matter as the node type info is saved into a different table than variables. So as long as the variables are being set synchronously with the creation of the node type, it shouldn't matter. Even then, the worst case scenario would be you'll have some redundant variables in the variables table. Which is not a big issue.

So to answer the question, yes that's the proper way. However I'd do it in the same function call in the .install file, maybe implement it in hook_install or hook_enable depending on what you need.