Drupal 10 upgrade: Deprecations
Steven Jones
One of the 'new' features in Drupal 10 is that it has removed lots of deprecated code. One of the things that means for our Drupal 10 upgrade project is that some of the modules that this website used are no-longer in Drupal core. Either there's a replacement for each one or they are simply in contrib-land and not supported using the full resources of Drupal core.
We'll go one by one looking at the deprecated modules and themes that the upgrade status module flagged to us:
CKEditor
We were using CKEditor 4, but Drupal core is only going to provide CKEditor 5. The main reason for doing this is that version 4 is going end-of-life in 2023.
Drupal 9.5 actually provides the nice upgrade path of being able to convert your text formats over to use CKEditor 5, you simply enable both modules, and then visit the text formats page and it guides you through the process.
However, there's also a little bit of work for us to do. In CKEditor 4 we were loading a custom CSS file, so that when editing text in our admin theme, it would look a lot more like our custom theme. This worked nicely, especially, as the actual CKEditor editable wysiwyg was actually an iframe that could load our CSS. We could essentially copy/paste the CSS (using our Sass preprocessor) so that if we modified the CSS for our frontend, a relevant version would be loaded by CKEditor when loading content. However, CKEditor 5 now doesn't use an iframe, so we had to fiddle with the file so that we wrapped everything in a nested:
.ck-content {
// Other CSS goes here.
}
Because we're using Sass, the CSS is preprocessed, so that all the selectors are prefixed with .ck-content
which is what we need to do now.
We also tweaked our config in our theme info file so that the new stylesheet would be picked up:
ckeditor5-stylesheets:
- dist/style-ckeditor5.css
But actually, pretty easy really.
Color
We were using color module to provide a very small amount of configurability for an old version of our theme, and after some review I noticed that we weren't actually using the functionality any more at all, so the easiest thing to do was to uninstall this module.
RDF
Again, with RDF, we determined that we weren't really using this module, so we uninstalled it.
Seven
Drupal 9 added the Claro admin theme, but we never moved over to it. This project seemed like a great opportunity to take the time to move over. So, I enabled the Claro theme, re-did any configuration changes we'd made to Seven, and re-placed blocks and that was basically it!
Claro is really clean and modern, and although some of our admin UI looks slightly worse imho, it's overall a net gain, and obviously Claro is supported, in core.
We'll work to make tweaks to the admin UI to improve things for ourselves, Drupal is great like that: where something isn't 100% what you want, you can change it!
Stable
We are using the Drupal 8 version of stable for our theme, it's our base theme. I didn't want to take on the work of upgrading/removing this dependency, so I've taken advantage of the fact that it's been spun out into it's own contrib project, and I've added that to our composer.json and that seems to have done the trick!
What's next?
Now we've removed all the deprecations, we need to work on upgrading any contrib modules in our codebase.