jstimer.install in Javascript Timer 8
Same filename and directory in other branches
Install, update and uninstall functions for the jstimer module. No db schema, just the variables.
File
jstimer.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the jstimer module.
* No db schema, just the variables.
*/
/**
* Updates separate jstimer format variables to new array format.
*/
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);
}
/**
* Implementation of hook_install().
*/
function jstimer_install() {
jstimer_build_js_cache();
drupal_clear_js_cache();
}
Functions
Name | Description |
---|---|
jstimer_install | Implementation of hook_install(). |
jstimer_update_7000 | Updates separate jstimer format variables to new array format. |