5 * Update functions for the HAL module.
9 * Move 'link_domain' from 'rest.settings' to 'hal.settings'.
11 function hal_update_8301() {
12 $config_factory = \Drupal::configFactory();
14 // The default value for the 'link_domain' key is `~`, which is the YAML
15 // equivalent of PHP's `NULL`. If the REST module is not installed, this is
16 // the value we will store in 'hal.settings'.
19 // But if the REST module was installed, we migrate its 'link_domain' setting,
20 // because we are actually moving that setting from 'rest.settings' to
22 $rest_settings = $config_factory->getEditable('rest.settings');
23 if ($rest_settings->getRawData() !== []) {
24 $link_domain = $rest_settings->get('link_domain');
25 // Remove the 'link_domain' setting from 'rest.settings'.
26 $rest_settings->clear('link_domain')
30 $hal_settings = $config_factory->getEditable('hal.settings');
31 $hal_settings->set('link_domain', $link_domain);
32 $hal_settings->save(TRUE);