Here's a typical update hook where we need to update the default config of a view provided by core:
function somemodule_update_1007() {
$data = array(
... 100s OF LINES OF CODE HERE ...
);
$config = config('some.config.file');
if ($config->isNew()) {
$config->setData($data);
$config->save();
}
}
I have always found this to be very annoying, because a) a dev has to convert the contents of the .json file to an array (to be used as the value of $data
), and b) we are adding 100s of lines of code to .install files, which makes them unreadable.
Why are we not doing something like this instead?:
function somemodule_update_1007() {
$new_config_file = backdrop_get_path('module', 'somemodule') . '/config/some.config.file.json';
$data = json_decode(file_get_contents($new_config_file), TRUE);
$config = config('some.config.file');
if ($config->isNew()) {
$config->setData($data);
$config->save();
}
}
GitHub Issue #:
3347
Recent comments
Yes, I mean something similar to Seven/Bartik/etc , but in another location. And yes, I've tried it, and it's not found. So I figured that there may have been a hook to load it or load it's...
Refactor code
Unfortunately the word" theme" is used in different ways. By "theme" do you mean the equivalent of Basis, Bartik, etc? (appearance themes). BTW, hook_theme has nothing to do with those...
Refactor code
But ultimately I would like to do a cleaner solution and convert the old <br> tags over to <p> tags using code. I love regexps so it's no problem to massage the HTML to what I want;...
Is there a way to programmatically enable CKEditor5?