uw_virtual_site_homepage.install 25.7 KB
Newer Older
1 2
<?php

Liam Morland's avatar
Liam Morland committed
3 4 5 6 7
/**
 * @file
 */

/**
8
 * Implements hook_update_dependencies().
Liam Morland's avatar
Liam Morland committed
9
 *
10 11
 * Setting the order of update hooks so that uw_virtual_site_homepage_update_7100 runs first.
 */
12
function uw_virtual_site_homepage_update_dependencies() {
13
  // Indicate that the uw_virtual_site_homepage_update_7100() function provided by this module
14
  // must run before the one of the os_profiles_update_N() function provided by the 'os_profiles' module.
15 16 17
  $dependencies['os_profiles'][7045] = array(
    'uw_virtual_site_homepage' => 7100,
  );
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  $dependencies['os_profiles'][7048] = array(
    'uw_virtual_site_homepage' => 7100,
  );
  $dependencies['os_profiles'][7049] = array(
    'uw_virtual_site_homepage' => 7100,
  );
  $dependencies['os_profiles'][7050] = array(
    'uw_virtual_site_homepage' => 7100,
  );
  $dependencies['os_profiles'][7051] = array(
    'uw_virtual_site_homepage' => 7100,
  );
  $dependencies['os_profiles'][7052] = array(
    'uw_virtual_site_homepage' => 7100,
  );
33 34 35
  return $dependencies;
}

36
/**
37
 * Implements hook_update_N().
Liam Morland's avatar
Liam Morland committed
38
 *
39 40
 * Changing Office Hours field name and instance for virtual homepages.
 */
Lily Yan's avatar
Lily Yan committed
41
function uw_virtual_site_homepage_update_7100() {
Eric Bremner's avatar
Eric Bremner committed
42 43 44
  // There is a conflict with os_profiles and uw_virtual_site_homepage for the field: field_office_hours.
  // We are going to change our custom module: uw_virtual_site_homepage, to use a field with name: field_uw_office_hours.
  // New field and instances will have to be created, all content migrated, all old instances removed.
45 46
  // Set variables, changing the below fields for uw homepage virtual sites.
  // Profile image, Site description, Faculty, Office location, Phone number, Extension, Email and Office hours.
47 48
  $entity_type = 'node';
  $bundle = 'uw_virtual_site_homepage';
49

50 51
  $old_names = array(
    'field_faculty',
52 53 54 55 56
    'field_office_location',
    'field_phone_number',
    'field_extension',
    'field_email_homepage',
    'field_office_hours',
57 58
    'field_profile_image',
    'body',
59
  );
60 61

  // Step through each of the old names and convert to new names.
62
  foreach ($old_names as $old_name) {
63 64

    // If this is the body, special new name, else insert uw into old field name.
65
    if ($old_name == 'body') {
Liam Morland's avatar
Liam Morland committed
66
      $new_name = 'field_uw_site_description';
67 68
    }
    else {
Liam Morland's avatar
Liam Morland committed
69
      $new_name = str_replace("field", "field_uw", $old_name);
70 71
    }

72
    // Get old fields' data.
73 74 75 76
    $field_data = db_select('field_data_' . $old_name, 'old')
      ->fields('old')
      ->condition('entity_type', $entity_type)
      ->condition('bundle', $bundle)
77
      ->execute();
78

79 80 81
    // Store old fields data.
    $counter = 0;
    $data_new = array();
82
    while ($data = $field_data->fetchAssoc()) {
83 84 85 86 87
      foreach ($data as $column => $value) {
        $column = str_replace($old_name, $new_name, $column);
        $data_new[$counter][$column] = $value;
      }
      $counter++;
88
    }
89 90

    // Get old fields' revisions.
91 92 93 94
    $field_revision = db_select('field_revision_' . $old_name, 'old')
      ->fields('old')
      ->condition('entity_type', $entity_type)
      ->condition('bundle', $bundle)
95 96
      ->execute();

97 98 99
    // Store old fields' revisions.
    $counter = 0;
    $revision_new = array();
100 101 102
    while ($revision = $field_revision->fetchAssoc()) {
      foreach ($revision as $column => $value) {
        $column = str_replace($old_name, $new_name, $column);
103
        $revision_new[$counter][$column] = $value;
104
      }
105
      $counter++;
106 107
    }

108
    // As long as not body, delete the old field.
Liam Morland's avatar
Liam Morland committed
109
    if ($old_name !== 'body') {
110 111
      field_delete_field($old_name);
    }
112

113
    // If there is no new field, create the new field.
Liam Morland's avatar
Liam Morland committed
114
    if (!db_table_exists('field_data_' . $new_name)) {
115 116 117
      $new_field = _get_new_field($new_name);
      field_create_field($new_field);
    }
118

119 120
    // Get the old instance.
    $check_old_instance = db_select('field_config_instance', 'fc')
Liam Morland's avatar
Liam Morland committed
121 122 123 124 125
      ->fields('fc')
      ->condition('field_name', $old_name)
      ->condition('entity_type', $entity_type)
      ->condition('bundle', $bundle)
      ->execute()->fetchAll();
126 127

    // If there is an old instance, delete it.
Liam Morland's avatar
Liam Morland committed
128
    if (count($check_old_instance) > 0) {
129 130 131
      $instance['field_name'] = $old_name;
      $instance['entity_type'] = $entity_type;
      $instance['bundle'] = $bundle;
132 133
      field_delete_instance($instance);
    }
134 135

    // Step through each of the old fields data and set it to the new fields data.
Liam Morland's avatar
Liam Morland committed
136
    foreach ($data_new as $data) {
137 138

      // If there is a new field, insert the old data.
Liam Morland's avatar
Liam Morland committed
139
      if (db_table_exists('field_data_' . $new_name)) {
140 141 142

        // Get the data from the new field.
        $check_for_field = db_select('field_data_' . $new_name, 'data')
Liam Morland's avatar
Liam Morland committed
143 144
          ->fields('data');
        foreach ($data as $key => $value) {
145 146 147 148 149
          $check_for_field->condition($key, $value);
        }
        $results = $check_for_field->execute();

        // Check if there is data from the old field in the new field.
Liam Morland's avatar
Liam Morland committed
150 151 152
        $insert = TRUE;
        while ($record = $results->fetchAssoc()) {
          $insert = FALSE;
153 154 155 156
          break;
        }

        // If there is no data from old field in new field, insert the old field data into the new field.
Liam Morland's avatar
Liam Morland committed
157
        if ($insert) {
158 159 160 161 162 163 164 165
          db_insert('field_data_' . $new_name)
            ->fields($data)
            ->execute();
        }
      }
    }

    // Step through each old revision and set it to the new revision.
Liam Morland's avatar
Liam Morland committed
166
    foreach ($revision_new as $revision) {
167 168

      // If there is a new revision, insert the old revision.
Liam Morland's avatar
Liam Morland committed
169
      if (db_table_exists('field_revision_' . $new_name)) {
170 171 172

        // Get the data from the new revision.
        $check_for_revision = db_select('field_revision_' . $new_name, 'data')
Liam Morland's avatar
Liam Morland committed
173 174
          ->fields('data');
        foreach ($revision as $key => $value) {
175 176 177 178 179
          $check_for_field->condition($key, $value);
        }
        $results = $check_for_field->execute();

        // Check if there is data from the old revision in the new revision.
Liam Morland's avatar
Liam Morland committed
180 181 182
        $insert = TRUE;
        if ($record = $results->fetchAssoc()) {
          $insert = FALSE;
183 184 185 186
          break;
        }

        // If there is no old revision in the new revision, insert the old revision in the new revision.
Liam Morland's avatar
Liam Morland committed
187
        if ($insert) {
188 189 190 191 192 193 194 195 196 197 198 199
          db_insert('field_revision_' . $new_name)
            ->fields($revision)
            ->execute();
        }
      }
    }
  }

  // Perform feature revert to place new instances of fields.
  features_revert_module('uw_virtual_site_homepage');
}

200 201
/**
 * Implements hook_update_N().
Liam Morland's avatar
Liam Morland committed
202
 *
203 204 205 206 207
 * Convert the value from field_uw_faculty to field_uw_faculty_list.
 * Remove field_uw_faculty field.
 */
function uw_virtual_site_homepage_update_7101() {

Liam Morland's avatar
Liam Morland committed
208
  // Revert fields.
209 210 211 212 213 214
  features_revert(array('uw_virtual_site_homepage' => array('field_base', 'field_instance')));

  // Convert the value from field_data_field_uw_faculty table to field_data_field_uw_faculty_list table.
  if (db_table_exists('field_data_field_uw_faculty') && db_table_exists('field_data_field_uw_faculty_list')) {
    $result = db_select('field_data_field_uw_faculty', 'f')
      ->fields('f')
215
      ->condition('bundle', 'uw_virtual_site_homepage', '=')
216
      ->execute()
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
      ->fetchAll();

    foreach ($result as $item) {
      $faculty_value = _get_faculty_list_value($item->field_uw_faculty_value);
      $data = array(
        'entity_type' => 'node',
        'bundle' => 'uw_virtual_site_homepage',
        'deleted' => 0,
        'entity_id' => $item->entity_id,
        'revision_id' => $item->revision_id,
        'language' => 'und',
        'delta' => 0,
        'field_uw_faculty_list_value' => $faculty_value,
      );
      drupal_write_record('field_data_field_uw_faculty_list', $data);
    }
233 234 235 236 237 238
  }

  // Convert the value from field_revision_field_uw_faculty to field_revision_field_uw_faculty_list.
  if (db_table_exists('field_revision_field_uw_faculty') && db_table_exists('field_revision_field_uw_faculty_list')) {
    $result2 = db_select('field_revision_field_uw_faculty', 'f')
      ->fields('f')
239
      ->condition('bundle', 'uw_virtual_site_homepage', '=')
240
      ->execute()
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
      ->fetchAll();

    foreach ($result2 as $item2) {
      $faculty_value2 = _get_faculty_list_value($item2->field_uw_faculty_value);
      $data2 = array(
        'entity_type' => 'node',
        'bundle' => 'uw_virtual_site_homepage',
        'deleted' => 0,
        'entity_id' => $item2->entity_id,
        'revision_id' => $item2->revision_id,
        'language' => 'und',
        'delta' => 0,
        'field_uw_faculty_list_value' => $faculty_value2,
      );
      drupal_write_record('field_revision_field_uw_faculty_list', $data2);
    }
257
  }
258

259 260 261 262 263 264 265 266 267 268
  drupal_set_message(t("Converted the value from the old faculty field to the new faculty field for the existing hompage setting node."));

  // Delete or remove field_uw_faculty field from uw_virtual_site_homepage content type.
  $field_uw_faculty = field_info_instance('node', 'field_uw_faculty', 'uw_virtual_site_homepage');
  if (!empty($field_uw_faculty)) {
    field_delete_field('field_uw_faculty');
    drupal_set_message(t('field_uw_faculty field has been successfully removed.'), 'status');
  }
}

269 270
/**
 * Implements hook_update_N().
Liam Morland's avatar
Liam Morland committed
271
 *
272 273 274
 * Perform feature revert.
 */
function uw_virtual_site_homepage_update_7102() {
Liam Morland's avatar
Liam Morland committed
275 276
  // Perform feature revert to place new instances of fields.
  features_revert_module('uw_virtual_site_homepage');
277 278 279 280
}

/**
 * Implements hook_update_N().
Liam Morland's avatar
Liam Morland committed
281
 *
282 283 284
 * Perform feature revert.
 */
function uw_virtual_site_homepage_update_7103() {
Liam Morland's avatar
Liam Morland committed
285 286
  // Perform feature revert to place new instances of fields.
  features_revert_module('uw_virtual_site_homepage');
287 288
}

289 290 291 292 293 294 295 296 297 298 299 300 301
/**
 * Implements hook_update_N().
 *
 * Update to use site footer logos from brand site.
 */
function uw_virtual_site_homepage_update_7104() {

 // Set defaults for api variables.
 variable_set('uw_site_footer_api_version', '1.0');
 variable_set('uw_site_footer_api_server', 'uwaterloo.ca');
 variable_set('uw_site_footer_api_site', 'brand');
 variable_set('uw_site_footer_ignore_certificates', 0);

302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
 // Update the facilty logo list field to not used previous keys
 // and allowed values function.
 $field_name = 'field_uw_faculty_list_logo';
 $field_definition = db_query("SELECT id, data FROM field_config WHERE field_name = :field_name LIMIT 1", array(':field_name' => $field_name))->fetchAll();
 $data = unserialize($field_definition[0]->data);
 $data['settings']['allowed_values'] = [];
 $data['settings']['allowed_values_function'] = '_uw_virtual_site_homepage_site_footer_allowed_values';

 db_update('field_config')
  ->condition('field_name', $field_name)
  ->fields(['data' => serialize($data)])
  ->execute();

 // Get the nodes that are site footers.
 $nodes = node_load_multiple(array(), array('type' => 'uw_virtual_site_homepage'));

 foreach ($nodes as $node) {
  if (isset($node->field_uw_faculty_list_logo) && !empty($node->field_uw_faculty_list_logo)) {

   $node->field_uw_faculty_list_logo = [
    'und' => [
     '0' => [
       'value' => _uw_virtual_site_homepage_get_logo_name($node->field_uw_faculty_list_logo['und'][0]['value']),
      ],
    ],
   ];

   node_save($node);
  }
331
 }
332
}
333

334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
/**
 * Helper function.
 *
 * Return the name of the site footer logo, given the key.
 */
function _uw_virtual_site_homepage_get_logo_name($logo_key = NULL, $with_nids = FALSE) {

 // If there is no key, return.
 if (!$logo_key) {
  return;
 }

 // The array that stores all the old information about the logos.
 $logos = array(
  'UWaterloo_logo' => $with_nids ? 356 : 'University of Waterloo',
  'UWaterloo_Applied_Health_Sciences' => $with_nids ? 366 : 'Applied Health Sciences',
  'UWaterloo_Applied_Health_Sciences_Kinesiology' => $with_nids ? 320 : 'Applied Health Sciences - Kinesiology',
  'UWaterloo_Applied_Health_Sciences_PublicHealth' => $with_nids ? 319 : 'Applied Health Sciences - Public Health',
  'UWaterloo_Applied_Health_Sciences_Recreation_Lesiure' => $with_nids ? 321 : 'Applied Health Sciences - Recreation and Leisure Studies',
  'UWaterloo_Arts' => $with_nids ? 365 : 'Arts',
  'UWaterloo_Arts_Anthropology' => $with_nids ? 322 : 'Arts - Anthropology',
  'UWaterloo_Arts_Classical_Studies' => $with_nids ? 323 : 'Arts - Classical Studies',
  'UWaterloo_Arts_Communication_Arts' => $with_nids ? 324 : 'Arts - Communication_Arts',
  'UWaterloo_Arts_Economics' => $with_nids ? 325 : 'Arts - Economics',
  'UWaterloo_Arts_English_Language_Literature' => $with_nids ? 326 : 'Arts - English Language Literature',
  'UWaterloo_Arts_FineArts' => $with_nids ? 327 : 'Arts - Fine Arts',
  'UWaterloo_Arts_French' => $with_nids ? 328 : 'Arts - French',
  'UWaterloo_Arts_Germanic_Slavic_Studies' => $with_nids ? 330 : 'Arts - Germanic Slavic Studies',
  'UWaterloo_Arts_History' => $with_nids ? 331 : 'Arts - History',
  'UWaterloo_Arts_Philosophy' => $with_nids ? 344 : 'Arts - Philosophy',
  'UWaterloo_Arts_Political_Science' => $with_nids ? 345 : 'Arts - Political Science',
  'UWaterloo_Arts_Psychology' => $with_nids ? 346 : 'Arts - Psychology',
  'UWaterloo_Arts_Religious_Studies' => $with_nids ? 348 : 'Arts - Religious Studies',
  'UWaterloo_Arts_School_of_Accounting_and_Finance' => $with_nids ? 378 : 'Arts - School of Accounting and Finance',
  'UWaterloo_Arts_Sociology_and_Legal_Studies' => $with_nids ? 354 : 'Arts - Sociology and Legal Studies',
  'UWaterloo_Arts_Spanish_and_Latin_American_Studies' => $with_nids ? 355 : 'Arts - Spanish and Latin American Studies',
  'UWaterloo_Engineering' => $with_nids ? 368 : 'Engineering',
  'UWaterloo_Engineering_wordmark' => $with_nids ? 360 : 'Engineering wordmark',
  'UWaterloo_Engineering_Architecture' => $with_nids ? 377 : 'Engineering - Architecture',
  'UWaterloo_Engineering_Chemical_Engineering' => $with_nids ? 334 : 'Engineering - Chemical Engineering',
  'UWaterloo_Engineering_Civil_Environmental_Engineering' => $with_nids ? 336 : 'Engineering - Civil Environmental Engineering',
  'UWaterloo_Engineering_Electrical_Computer_Engineering' => $with_nids ? 340 : 'Engineering - Electrical Computer Engineering',
  'UWaterloo_Engineering_Management_Sciences' => $with_nids ? 342 : 'Engineering - Management Sciences',
  'UWaterloo_Engineering_Mechanical_Engineering' => $with_nids ? 343 : 'Engineering - Mechanical Engineering',
  'UWaterloo_Engineering_Systems_Design_Engineering' => $with_nids ? 358 : 'Engineering - Systems Design Engineering',
  'UWaterloo_Environment' => $with_nids ? 367 : 'Environment',
  'UWaterloo_Environment_50th_Anniversary' => $with_nids ? 403 : 'Environment - 50th Anniversary',
  'UWaterloo_Environment_Environment_Enterprise_Development' => $with_nids ? 376 : 'Environment - Environment Enterprise Development',
  'UWaterloo_Environment_Enviromental_Resources_and_Sustainability' => $with_nids ? 375 : 'Environment - Enviromental Resources and Sustainability',
  'UWaterloo_Environment_Geography_Environmental_and_Management' => $with_nids ? 329 : 'Environment - Geography Environmental and Management',
  'UWaterloo_Environment_Knowledge_Intergration' => $with_nids ? 341 : 'Environment - Knowledge Intergration',
  'UWaterloo_Environment_Planning' => $with_nids ? 372 : 'Environment - Planning',
  'UWaterloo_Mathematics' => $with_nids ? 369 : 'Mathematics',
  'UWaterloo_Math_Applied_Math' => $with_nids ? 332 : 'Mathematics - Applied Math',
  'UWaterloo_Math_Combinatorics_and_Optimization' => $with_nids ? 338 : 'Mathematics - Combinatorics and Optimization',
  'UWaterloo_Math_Computer_Science' => $with_nids ? 379 : 'Mathematics - Computer Science',
  'UWaterloo_Math_Pure_Math' => $with_nids ? 347 : 'Mathematics - Pure Math',
  'UWaterloo_Math_Statistics_Actuarial_Science' => $with_nids ? 357 : 'Mathematics - Statistics Actuarial Science',
  'UWaterloo_Science' => $with_nids ? 370 : 'Science',
  'UWaterloo_Science_Biology' => $with_nids ? 333 : 'Science - Biology',
  'UWaterloo_Science_Chemistry' => $with_nids ? 335 : 'Science - Chemistry',
  'UWaterloo_Science_Earth_and_Environmental_Science' => $with_nids ? 339 : 'Science - Earth and Environmental Science',
  'UWaterloo_Science_Optometry_and_Vision_Science' => $with_nids ? 374 : 'Science - Optometry and Vision Science',
  'UWaterloo_Sciecne_Pharmacy' => $with_nids ? 373 : 'Science - Pharmacy',
  'UWaterloo_Science_Physics_and_Astronomy' => $with_nids ? 402 : 'Science - Physics and Astronomy',
  'conrad_grebel' => $with_nids ? 389 : 'Conrad Grebel',
  'renison_university_college' => $with_nids ? 391 : 'Renison University College',
  'st_jeromes_university' => $with_nids ? 392 : 'St. Jerome\'s University',
  'st_pauls' => $with_nids ? 393 : 'St. Paul\'s University College',
  'McMaster_University' => $with_nids ? 390 : 'McMaster University',
  'Print_and_Retail_Solutions' => $with_nids ? 364 : 'Print and Retail Solutions',
  'Survey_Research_Centre' => $with_nids ? 394 : 'Survey Research Centre',
  'Sustainable_Development_Solutions_Network_(SDSN)_Canada' => $with_nids ? 395 : 'Sustainable Development Solutions Network (SDSN) Canada',
  'University_of_Guelph' => $with_nids ? 396 : 'University of Guelph',
  'Waterloo_Centre_for_Microbial_Research' => $with_nids ? 398 : 'Waterloo Centre for Microbial Research',
  'Waterloo_Institute_for_Complexity_and_Innovation' => $with_nids ? 399 : 'Waterloo Institute for Complexity and Innovation',
  'Water_Institute' => $with_nids ? 397 : 'Water Institute',
  'Western_University' => $with_nids ? 400 : 'Western University',
  'Wilfrid_Laurier_University' => $with_nids ? 401 : 'Wilfrid Laurier University',
  'UWaterloo_Arts_Stratford_School_Interaction_Design_Business' => $with_nids ? 371 : 'Arts - Stratford School of Interaction Design and Business',
  'UWaterloo_Engineering_Conrad_School_of_Entrepreneurship_and_Business' => $with_nids ? 380 : 'Conrad School of Entrepreneurship and Business',
 );

 // If there is a logo with the key return it,
 // if there is not logo simply return.
 if (isset($logos[$logo_key])) {
  return $logos[$logo_key];
 }
 else {
  return;
 }
425 426
}

427
/**
Liam Morland's avatar
Liam Morland committed
428
 * Helper function to get the value from field_uw_faculty.
429 430 431
 */
function _get_faculty_list_value($field_uw_faculty) {
  $faculty_name = strtolower($field_uw_faculty);
432
  if (strpos($faculty_name, 'university of waterloo') !== FALSE) {
433 434 435
    $faculty_list_value = 'default';
  }

436
  if (strpos($faculty_name, 'faculty of applied health sciences') !== FALSE) {
437 438 439
    $faculty_list_value = 'ahs';
  }

440
  if (strpos($faculty_name, 'faculty of arts') !== FALSE || strpos($faculty_name, 'arts') !== FALSE) {
441 442 443
    $faculty_list_value = 'arts';
  }

444
  if (strpos($faculty_name, 'faculty of engineering') !== FALSE || strpos($faculty_name, 'engineering') !== FALSE) {
445 446 447
    $faculty_list_value = 'engineering';
  }

448
  if (strpos($faculty_name, 'faculty of environment') !== FALSE) {
449 450 451
    $faculty_list_value = 'environment';
  }

452
  if (strpos($faculty_name, 'faculty of mathematics') !== FALSE || strpos($faculty_name, 'mathematics') !== FALSE) {
453 454 455
    $faculty_list_value = 'math';
  }

456
  if (strpos($faculty_name, 'faculty of science') !== FALSE) {
457 458 459
    $faculty_list_value = 'science';
  }

460
  if (strpos($faculty_name, 'conrad grebel university college') !== FALSE) {
461 462 463
    $faculty_list_value = 'cgc';
  }

464
  if (strpos($faculty_name, 'renison university college') !== FALSE) {
465 466 467
    $faculty_list_value = 'ren';
  }

468
  if (strpos($faculty_name, 'st. jerome') !== FALSE) {
469 470 471
    $faculty_list_value = 'stj';
  }

472
  if (strpos($faculty_name, 'st. paul') !== FALSE) {
473 474 475 476 477 478
    $faculty_list_value = 'stp';
  }

  return $faculty_list_value;
}

479
/**
Liam Morland's avatar
Liam Morland committed
480
 * Helper function to get the new field information.
481
 */
482
function _get_new_field($name) {
Liam Morland's avatar
Liam Morland committed
483
  switch ($name) {
484 485
    case "field_uw_email_homepage":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_email_homepage',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
512

513 514 515 516
      return $new_field;

    case "field_uw_email_homepage":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_email_homepage',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
543 544 545 546 547

      return $new_field;

    case "field_uw_extension":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_extension',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
574

575 576 577 578
      return $new_field;

    case "field_uw_faculty":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_faculty',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
605

606 607 608 609
      return $new_field;

    case "field_uw_office_hours":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_office_hours',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(),
        'translatable' => 0,
        'type' => 'text_long',
      );
634

635 636 637 638
      return $new_field;

    case "field_uw_office_location":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_office_location',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
665

666 667 668 669
      return $new_field;

    case "field_uw_phone_number":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_phone_number',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(
          'max_length' => 255,
        ),
        'translatable' => 0,
        'type' => 'text',
      );
696

697 698 699 700
      return $new_field;

    case "field_uw_profile_image":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(),
        'field_name' => 'field_uw_profile_image',
        'foreign keys' => array(
          'fid' => array(
            'columns' => array(
              'fid' => 'fid',
            ),
            'table' => 'file_managed',
          ),
        ),
        'indexes' => array(
          'fid' => array(
            0 => 'fid',
          ),
        ),
        'locked' => 0,
        'module' => 'image',
        'settings' => array(
          'default_image' => 0,
          'uri_scheme' => 'public',
        ),
        'translatable' => 0,
        'type' => 'image',
      );
728

729 730 731 732
      return $new_field;

    case "field_uw_site_description":
      $new_field = array(
Liam Morland's avatar
Liam Morland committed
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
        'active' => 1,
        'cardinality' => 1,
        'deleted' => 0,
        'entity_types' => array(
          0 => 'node',
        ),
        'field_name' => 'field_uw_site_description',
        'foreign keys' => array(
          'format' => array(
            'columns' => array(
              'format' => 'format',
            ),
            'table' => 'filter_format',
          ),
        ),
        'indexes' => array(
          'format' => array(
            0 => 'format',
          ),
        ),
        'locked' => 0,
        'module' => 'text',
        'settings' => array(),
        'translatable' => 0,
        'type' => 'text_with_summary',
      );
759

760 761
      return $new_field;
  }
762
}