Same name and namespace in other branches
  1. 8.x-1.x quicktabs.install \quicktabs_update_7303() 1 comment

Add support for view modes.

File

./quicktabs.install, line 185

Code

function quicktabs_update_7303() {
    foreach (quicktabs_load_multiple() as $quicktab) {
        $updated = FALSE;
        foreach ($quicktab->tabs as &$tab) {
            if ($tab['type'] === 'node') {
                $tab['view_mode'] = !empty($tab['teaser']) ? 'teaser' : 'full';
                unset($tab['teaser']);
                $updated = TRUE;
            }
        }
        if (!$updated) {
            continue;
        }
        if (empty($quicktab->in_code_only)) {
            $result = drupal_write_record('quicktabs', $quicktab, 'machine_name');
        }
        else {
            $result = drupal_write_record('quicktabs', $quicktab);
        }
        if (!$result) {
            throw new DrupalUpdateException(t('Could not complete the update.'));
        }
    }
    return 'Added support for view modes.';
}