You are here

function commons_bw_update_7302 in Drupal Commons 7.3

Make sure existing nodes titles are migrated to the title field. per http://drupal.org/node/1969088.

File

modules/commons/commons_bw/commons_bw.install, line 22

Code

function commons_bw_update_7302() {
  foreach (node_type_get_types() as $node_type) {

    // Set the title as "Replaced by title_field".
    if (!title_field_replacement_enabled('node', $node_type->type, 'title')) {
      title_field_replacement_toggle('node', $node_type->type, 'title');
    }

    // Migrate the titles to the title field.
    title_field_replacement_batch_set('node', $node_type->type, 'title');
  }
  drupal_flush_all_caches();
}