Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
Claro theme
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
25 Feb 2026 at 03:51 UTC
Updated:
1 Apr 2026 at 06:45 UTC
Jump to comment: Most recent
Themes can now be OOP.
Let's convert Claro.
Open claro.theme
Use rector to convert
Review
Follow ups:
Remove check for core media: formMediaFormAlter
Create follow up for organization and DI
Create follow up to replace remaining functions:
N/A
N/A
N/A
N/A
N/A
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nicxvan commentedComment #4
nicxvan commentedComment #5
nicxvan commentedComment #6
berdirAdded a few specific points.
I think here too, DI is doable and this is much bigger than olivero, but I still think we should do some basic amount of splitting here. Finding a good grouping for all the preprocess stuff is not trivial, but I'd really like the form alters and other actual hooks to be separate from all the preprocess stuff? ClaroPreprocessHooks, ClaroFormHooks, ClaroHooks?
Comment #7
nicxvan commentedSplitting codes out after an automated conversion really feels out of scope, same with DI.
The thing is with automated conversions you can't rebase, you just have to repeat the process.
The more manual changes after conversion the more risk you miss or break something.
All of the automated conversions have followed this pattern:
This has been very successful, I'd hesitate to change the process since it's not very sustainable.
I know introducing DI has taken far longer than we'd like in module hooks so it's tempting to ensure it's done first here but I think it won't linger as much here.
I fixed the references and I can try reverting the readme if you think it's important.
Comment #8
nicxvan commentedAddressed the feedback except DI and organization.
I explained why in the previous comment and @berdir mentioned in slack he wouldn't push for it further.
Comment #9
nicxvan commentedNeeds regenerating
Comment #10
nicxvan commentedComment #11
nicxvan commentedIt was actually a change in a comment I manually updated so I was able to rebase normally.
It was this change: https://git.drupalcode.org/project/drupal/-/merge_requests/14876/diffs#c...
That isn't correct so I changed it to
Implements hook_preprocess_HOOK()Comment #12
dcam commentedI'm glad there was an agreement on no additional changes because this was already annoying with all of the unnecessary array reformatting. At least they were all minor differences. But having to parse additional code changes when comparing the diffs of two 1600 line files would be rough to review.
I left a bunch of comments, mostly about lingering references. But I didn't see anything wrong with the current changes.
BTW, let me know if there would be a better way to note problems like this than what I've done here.
Comment #13
nicxvan commentedI removed the function.
The comment cleanup should be a follow up I think.
Comment #14
dcam commentedWe discussed in Slack to not edit the docblocks. The other feedback was addressed. It looks good to me.
For the record, @smustgrave is working on the deprecation removal in #3575462: Remove deprecations from themes and misc.
Comment #15
dcam commented#3575462: Remove deprecations from themes and misc got committed and there's a conflict for this MR now.
Comment #16
nicxvan commentedI rebased, since it was just a deprecation removal I just removed that from the output.
Comment #17
dcam commentedThe deleted hook was removed from the MR. Back to RTBC.
Comment #19
nicxvan commented@sivaji, please do not push any commits to this issue, it uses rector so it's more complex than a usual issue, that is why it is assigned to me.
Thank you for your reviews on all of the other issues!
Comment #21
catchCommitted/pushed to main, thanks!
Looks like this needs an 11.x backport MR.
Comment #23
nicxvan commentedOk what I did was run
git apply --reject --whitespace=fix patches/claro.patchThis got all changes except the use statement and hook deletions in claro.theme I manually deleted those since it is one block.
Then I looked at the two conflicts:
https://git.drupalcode.org/project/drupal/-/commit/49c2dc169308eb2789929...
and
https://git.drupalcode.org/project/drupal/-/commit/4f51b64b77bb0c42e8d56...
The first I didn't replicate since it's wrong and it was corrected on the main branch already.
The second I manually created the OOP hook here: https://git.drupalcode.org/project/drupal/-/merge_requests/15104/diffs?c...
Comment #25
nicxvan commentedComment #26
dcam commentedI figured that the easiest way to review this is to diff the diffs of the two MRs.
They are nearly identical. There are only two differences:
preprocess_block_content_add_list()function was moved toClaroHookswhereas it was removed in main.I then compared the moved
preprocess_block_content_add_list()function to the original version. It was copied faithfully to the hooks class. There's nothing to say about it.So MR 15104 is nearly the same as the changes that went into main. LGTM.
Comment #28
catchCommitted/pushed to 11.x, thanks!
Comment #31
sivaji_ganesh_jojodae commentedFollow up issue https://www.drupal.org/project/drupal/issues/3579925