function node_update_7004

Extend the existing default preview and teaser settings to all node types.

Related topics

File

modules/node/node.install, line 573

Code

function node_update_7004() {
  // Get original settings and all types.
  $original_length = variable_get('teaser_length', 600);
  $original_preview = variable_get('node_preview', 0);
  // Map old preview setting to new values order.
  $original_preview ? $original_preview = 2 : ($original_preview = 1);
  node_type_cache_reset();
  // Apply original settings to all types.
  foreach (_update_7000_node_get_types() as $type => $type_object) {
    variable_set('teaser_length_' . $type, $original_length);
    variable_set('node_preview_' . $type, $original_preview);
  }
  // Delete old variable but leave 'teaser_length' for aggregator module upgrade.
  variable_del('node_preview');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.