function js_injector_update_8000 in JS injector 8
Migrate js_injector rules into configuration.
File
- ./
js_injector.install, line 31 - js_injector.install
Code
function js_injector_update_8000() {
$uuid = new Uuid();
$rules = db_select('js_injector_rule', 'r')
->fields('r')
->execute()
->fetchAll();
foreach ($rules as $rule) {
config('js_injector.rule.' . $rule->crid)
->set('id', $rule->crid)
->set('uuid', $uuid
->generate())
->set('label', $rule->name)
->set('weight', $rule->weight)
->set('langcode', LANGUAGE_NOT_SPECIFIED)
->save();
}
update_config_manifest_add('js_injector.rule', array_map(function ($rule) {
return $rule->crid;
}, $rules));
}