open_readspeaker.install in Open ReadSpeaker 8
Same filename and directory in other branches
Requirements and update functions for the Open ReadSpeaker module.
File
open_readspeaker.installView source
<?php
/**
* @file
* Requirements and update functions for the Open ReadSpeaker module.
*/
use Drupal\Core\Config\FileStorage;
/**
* Rename the open_readspeaker_dev_mode config to open_readspeaker_post_mode.
*/
function open_readspeaker_update_8101() {
$config_factory = \Drupal::configFactory();
$config = $config_factory
->getEditable('open_readspeaker.settings');
$config
->set('open_readspeaker_post_mode', $config
->get('open_readspeaker_dev_mode'));
$config
->clear('open_readspeaker_dev_mode');
$config
->save(TRUE);
}
/**
* Remove unnecessary and unused config 'open_readspeaker.'
*/
function open_readspeaker_update_8102() {
$config_factory = \Drupal::configFactory();
$config = $config_factory
->getEditable('open_readspeaker.settings');
$config
->clear('open_readspeaker');
$config
->save(TRUE);
}
/**
* Make the ReadSpeaker URL configureable using tokens.
*/
function open_readspeaker_update_8103() {
$source = new FileStorage(__DIR__ . '/config/install');
$newConfig = $source
->read('open_readspeaker.settings');
$config_factory = \Drupal::configFactory();
$config = $config_factory
->getEditable('open_readspeaker.settings');
$config
->set('open_readspeaker_url', $newConfig['open_readspeaker_url']);
$config
->save(TRUE);
}
Functions
Name | Description |
---|---|
open_readspeaker_update_8101 | Rename the open_readspeaker_dev_mode config to open_readspeaker_post_mode. |
open_readspeaker_update_8102 | Remove unnecessary and unused config 'open_readspeaker.' |
open_readspeaker_update_8103 | Make the ReadSpeaker URL configureable using tokens. |