You are here

function tvi_update_7003 in Taxonomy Views Integrator 7

Add inherit parameters to settings where it's missing.

File

./tvi.install, line 111
Install, update, and uninstall functions for the tvi module.

Code

function tvi_update_7003(&$sandbox) {
  tvi_include('query');
  $settings = db_select('variable', 'v')
    ->fields('v', array(
    'name',
  ))
    ->condition('name', 'tvi_%', 'LIKE')
    ->execute()
    ->fetchAll();
  foreach ($settings as $setting) {
    list($_, $type, $xid) = explode('_', $setting->name);
    $setting = tvi_load_settings($xid, $type, FALSE);
    if ($setting && $setting->type == TVI_TYPE_TERM && empty($setting->inherit)) {
      $setting->inherit = FALSE;
    }
    if ($setting) {
      tvi_update_settings($setting);
    }
  }
}