You are here

function drush_title_upgrade_title_field in Title 7

Command callback for upgrade-title-field.

File

./title.drush.inc, line 99
Drush commands for Title module.

Code

function drush_title_upgrade_title_field($entity_type, $bundle, $legacy_field) {
  $dt_args['@entity_type'] = $entity_type;
  $dt_args['@bundle'] = $bundle;
  $dt_args['@field'] = $legacy_field;
  if (!title_field_replacement_toggle($entity_type, $bundle, $legacy_field)) {
    drush_log(dt("Failed to upgrade title field '@field' on content type @bundle.", $dt_args), 'warning');
    return FALSE;
  }
  title_field_replacement_batch_set($entity_type, $bundle, $legacy_field);
  drush_backend_batch_process();
  if (drush_get_error()) {
    drush_log(dt("Failed upgrading title field '@field' on bundle '@bundle'. Your database is likely messed up now. Sorry about that.", $dt_args), 'error');
    return FALSE;
  }
  drush_log(dt("Upgraded title field '@field' on content type @bundle.", $dt_args), 'success');
  return TRUE;
}