You are here

function jstimer_update_7000 in Javascript Timer 8

Same name and namespace in other branches
  1. 7 jstimer.install \jstimer_update_7000()

Updates separate jstimer format variables to new array format.

File

./jstimer.install, line 13
Install, update and uninstall functions for the jstimer module. No db schema, just the variables.

Code

function jstimer_update_7000() {
  $formats = array();
  $formats[] = \Drupal::config('jstimer.settings')
    ->get('jstimer_output_format');
  $formats[] = \Drupal::config('jstimer.settings')
    ->get('jstimer_output_format_1');
  $formats[] = \Drupal::config('jstimer.settings')
    ->get('jstimer_output_format_2');
  $formats[] = \Drupal::config('jstimer.settings')
    ->get('jstimer_output_format_3');
  foreach ($formats as $i => $format) {
    if ($format == '') {
      unset($formats[$i]);
    }
  }
  $formats = array_values($formats);

  // @FIXME
  // // @FIXME
  // // This looks like another module's variable. You'll need to rewrite this call
  // // to ensure that it uses the correct configuration object.
  // variable_set('jst_timer_formats', $formats);
  \Drupal::config('jstimer.settings')
    ->clear('jstimer_output_format')
    ->save();
  \Drupal::config('jstimer.settings')
    ->clear('jstimer_output_format_1')
    ->save();
  \Drupal::config('jstimer.settings')
    ->clear('jstimer_output_format_2')
    ->save();
  \Drupal::config('jstimer.settings')
    ->clear('jstimer_output_format_3')
    ->save();
  $msg = \Drupal::config('jstimer.settings')
    ->get('jstimer_complete_statement');

  // @FIXME
  // // @FIXME
  // // This looks like another module's variable. You'll need to rewrite this call
  // // to ensure that it uses the correct configuration object.
  // variable_set('jst_timer_complete_message', $msg);
}