You are here

function commerce_kickstart_update_7216 in Commerce Kickstart 7.2

Revert body field to text with summary type.

File

./commerce_kickstart.install, line 1123
Installation code for Commerce Kickstart.

Code

function commerce_kickstart_update_7216() {
  if (db_table_exists('field_data_body') && !db_field_exists('field_data_body', 'body_summary')) {

    // Force field type change.
    db_update('field_config')
      ->fields(array(
      'type' => 'text_with_summary',
    ))
      ->condition('field_name', 'body')
      ->execute();

    // Add summary field to Body field tables.
    $summary_field = array(
      'type' => 'text',
      'size' => 'big',
      'not null' => FALSE,
    );
    db_add_field('field_data_body', 'body_summary', $summary_field);
    db_add_field('field_revision_body', 'body_summary', $summary_field);

    // Revert field components of features with body field features.
    $modules = array_filter(array(
      'commerce_kickstart_product',
      'commerce_kickstart_lite_product',
      'commerce_kickstart_blog',
    ), 'module_exists');
    $revert = array();
    foreach ($modules as $module) {
      $revert[$module][] = 'field';
    }
    if (!empty($revert)) {
      features_revert($revert);
    }
  }
}