Problem/Motivation
This issue provides the actual MR to merge Gin into core under the name admin. Detailed tasks and issues can be found over at #3530849: [META] Gin 6.x: Preparation for merging into core.
Test instructions
Use Drupal 11.x and apply the patch from MR!13737. Afterwards, run these commands:
drush pmu toolbar
drush en -y navigation
drush then admin
drush cset system.theme admin admin
drush thun gin
drush thun claro
drush cr
There are 2 feature flags:
$settings['core_admin_theme_use_sticky_action_buttons'];
$settings['user_login_admin_theme'];
The first one default to never, allowed values are content_forms and always.
The second one defaults to TRUE and can optionally be turned off.
Remaining tasks
Pass all linting
Pass tests
Comments
Comment #3
jurgenhaasComment #4
jurgenhaasComment #5
jurgenhaasRegarding cspell errors, here is the list of words that are available in settings and javascript, that we should ignore:
Where should they go?
Or should we ignore CSS, and JS files, and change the names of settings properties?
Comment #7
quietone commentedI made a commit of a what I wanted to add as suggestions but GitLab is painfully slow for me so I gave up. The commit includes changes like 'dark mode' instead of 'darkmode' because it is referring to the mode, not the name of the setting. Also, in a few cases I tried to make the distinction between any admin theme and this particular admin theme. Those are user facing and should be checked carefully.
In fact, it is usually confusing what is meant by 'admin' and 'admin theme' in the comments. Is it referring to this particular theme or any administrative theme?
And, I think the doc pages should include an introductory remark for developers that Admin involved from Gin and thus many settings etc use the word 'gin'.
Comment #8
quietone commentedI get 28 words flagged by cspell. Of those 11 are in the cpp dictionary and one in the css dictionary. That is not enough to consider enabling those dictionaries, not that we would use the C++ dictionary anyway. And using the css one is for another issue. Next, is to consider renaming. I think that improves readability so I would prefer that option. However, js and css are not my area so this needs more opinions are needed. If it helps the discussion I can do the renaming work.
Comment #9
quietone commentedI followed the steps in the issue summary after logging in the admin pages result in
Comment #10
pameeela commentedI got the same as #9 but resolved it by uninstalling the Toolbar module. Then you also will want to enable Navigation.
Is it enough just to document that this is needed if you are looking to switch your site over?
Comment #11
pameeela commentedAlong with general testing, I tested the feature flags and all worked as expected:
Overall I am in awe of the work that has been done on this so quickly @jurgenhaas and @saschaeggi and whoever else was involved in this superhuman effort :)
Comment #12
quietone commentedThere are instances of "Gin" in comments that I think should now be changed to "Admin". I was making suggestions for those but GitLab was being a bit faster. But then I discovered that it isn't showing all the files in the change. So, I am going to step away from this for now. Maybe tomorrow I will make a commit for those changes.
Comment #13
pameeela commented@quietone indeed the size of this MR makes it quite difficult to work with. I would say that updating references to Gin in comments can be done in a follow up mostly for that reason!
Comment #14
quietone commented@pameeela, thanks! I've updated the issue summary with that.
I also added remaining tasks to help keep track of things to do
Comment #15
jurgenhaasThanks @pameeela and @quietone for your feedback.
The changes in #14 seem to be missing, though.
I'll work though everything else, including that toolbar issue. And yes, working in follow-ups would make things much easier, but only if we feel comfortable with the initial MR, of course.
I'm wondering, should we add a component "Admin theme" to the core project?
Comment #16
poker10 commentedThanks for working on this!
I think that it was discussed earlier that Gin will support Toolbar (only the one default position) until it is removed from core. So I think we should fix that error instead of forcing users to use Navigation.
Comment #17
quietone commented@jurgenhaas, I've updated it again.
Comment #18
quietone commentedI couldn't think of a reason not to, so I did.
Comment #19
jurgenhaasThe toolbar issue should be resolved. It only occurred when toolbar was enabled AND navigation was disabled.
Comment #20
longwaveAre we keeping the
ginmachine name in classes, config, settings keys, etc? There are a lot of references - and changing some of these once this is released will probably be more difficult.Comment #21
jurgenhaasRenaming classes and variables in CSS and JS is something that should be done after the deduplication of Claro components has been completed. That's all the files till remaining in the
migrationdirectory having to be merged into the files in thecssandjsdirectories. It was agreed that this can be done after merge and Sascha is going to break this into smaller tasks so that more people, and not just him, can work on this.Comment #22
jurgenhaas@quietone 2 threads still open, one of which I can't find the answer to and the other which is taken over from Claro.
Other than that, the following tests are still failing:
.cspell.json?Comment #23
longwaveI pushed a commit to update the PHPStan baseline, this is new from Symfony 7.4 and only temporary until #3555532: Since symfony/http-foundation 7.4: Request::get() is deprecated, use properties ->attributes, query or request directly instead. is fixed.
Regarding CSS, if I run
yarn build:cssI get different build output. Shouldn't any deduplication or other fixes be happening on the .pcss.css files, and the .css files should be machine generated from those? If the .pcss.css and .css differ it feels like something has gone wrong.yarn build:cssmust run cleanly in case we need to update any other PostCSS files.For JS we can run
yarn lint:core-js-passing --fixto solve most of the formatting problems although there are 40 or so manual fixes to do after that. In the meantime we could skip this by adding to.eslintignoreas long as there is a followup to remove it again?For CSpell ideally we should add
cspell:ignorecomments to files where the spelling will only appear once (eberhard, grossgasteiger, micha only appear in themes/admin/login/js/wallpaper.js for example). I think some of the others warrant further investigation - I didn't check them all buttoolsextraonly appears once in a class name, so does this mean it isn't used? Similartablesawonly appears in the context of.tablesaw-cell-contentwhich is a class name that I don't see in use.Comment #24
jurgenhaasThank you for the updated baseline @longwave, that's amazing.
As for CSS and JS, I'd leave that to Sascha and others to decide, as I'm not really the expert here.
But I'll look into the spelling details for each of the words to see how many of those we can get rid of, and then review the remaining list which should probably be much shorter.
Comment #25
saschaeggi@longwave
I guess you're referring to the JS inside of
migration. We could go either way, but the goal would be to migrate/consolidate those and we'd remove this afterwards.Regarding CSS, if I run yarn build:css I get different build output. Shouldn't any deduplication or other fixes be happening on the .pcss.css files, and the .css files should be machine generated from those? If the .pcss.css and .css differ it feels like something has gone wrong. yarn build:css must run cleanly in case we need to update any other PostCSS files.Similar story, where do we get a different build output? Yes, that should be the case. Maybe there was something we didn't pay attention to and it made it's way directly to the
.cssbut that would need to be updated to be included in the.pcssfile. For the stuff that is in themigrationfolder still needs to be migrated, for those we only kept the.cssoutput as it was written inSCSSbefore (for historical reasons).Comment #26
berdirI'm not exactly sure in which issue I should comment and if I should at all.
I'm a bit concerned about the scope of this (just looking at the PHP code, this might be the biggest code addition since views got into core in a single MR?). There are thousands of lines of preprocess and other hooks. It's not realistic that this is all meaningfully reviewed. I understand that the decision was made and there isn't really an alternative for this initial merge, but still, there is a lot of very opinionated code that contains all kind of customizations and as already discussed, various workarounds for older versions and contrib and so. I added one more comment on a media alter.
I also noticed that the info.yml file hasn't been adjusted yet. I'm not sure if we support the lifecycle definition in themes, but if so, this should probably be experimental? also stuff like package, version and so on.
I saw that the user login theme negotiator issue was closed in favor of this, making this even bigger and also including changes to non-experimental extensions. Do we really need that feature in the initial merge of this?
Comment #27
longwaveFor the JS I've ignored the migration directory via .eslintignore and fixed the issues in
core/themes/admin/login/js/wallpaper.js. I've also skipped cspell on the wallpaper filenames while I was there.@saschaeggi to see the different build output just check out this branch and run
yarn build:cssfrom the core directory - a large number of the admin .css files get updated with various changes:If we are shipping both .pcss.css and .css files then the build output must be clean/unchanged before this can be committed, because otherwise the next issue to work on this will not know which is correct.
Note so far I'm only looking at this from the technical point of view to get it to pass CI, I share some of the concerns with @berdir about scope and haven't done any manual testing at all.
Comment #28
jurgenhaasWent through all the cspell strings and managed to either ignore them or to rename them. This test is now green.
So, we're down to CSS test being the final one that fails.
Comment #29
jurgenhaasI'm now working through the PCSS/CSS diffs and get them sorted.
Comment #30
jurgenhaasWe're getting close to a green CSS linter test. The CSS files are now all properly checked, and I managed to fix around 1.200 prettier issues semi-automatically.
What's left are 38 prettier issues that are related to colour syntax. This goes beyond my pay grade, that needs to be checked and fixed by an expert.
Regarding the concerns in #26:
The MR is huge, can't argue that. What would have been a better approach to this then?
The reason for handling this change here as well is that none of the two separate MRs would ever pass tests in isolation, that's why they can only come together. And the reasoning for why this is needed in the first place has been quoted from the Slack discussion with @lauriii.
Comment #31
berdir> The reason for handling this change here as well is that none of the two separate MRs would ever pass tests in isolation, that's why they can only come together. And the reasoning for why this is needed in the first place has been quoted from the Slack discussion with @lauriii.
What tests? Drupal CMS tests? There are no tests in this MR. I don't think this needs to satisfy Drupal CMS exceptations on day 1. Removed contrib integrations will also need to find a new home, it'll need some new dependencies for that anyway. The discussion with @laurii is on how it should be done, which I agree with, not that it needs to be done and must be included.
I also left some review comments on that part, I really think this needs more scrutiny and careful review (and tests).
Comment #32
jurgenhaasTo address the concerns about the user module and the special login handling, we've just removed that part from the MR and propose to deal with that afterwards back in the original issue at #3554693: Admin Theme: support admin theme login.
Comment #33
jurgenhaasThere are 3 functional javascript tests failing, everything else is green. The failures are:
I've tried everything that came to mind, I can't figure out what's wrong with them. Any help would be much appreciated.
Comment #34
berdirThe page deprecation is https://www.drupal.org/node/3458593, you need to update your node templates to not check for page.
Comment #35
jurgenhaasI've rebased the MR to also contain the security fixes from last night. One of the 3 test failures disappeared. The first test failure is a missing "Save" button that I can't reproduce.
For that one, we would appreciate a hint on what might be wrong in the templates, @berdir. We've checked but could figure out what exactly would have to be changed.
Comment #36
berdirSee https://git.drupalcode.org/project/drupal/-/commit/685ad2ba89418998c5912.... You need to stop checking the page variable in your node and term twig templates and look at the view mode instead (which you copied from classy)
Comment #37
catchNot sure what the process is for changes in Claro, but #2409559: User should be able to identify required fields from field listing added new CSS to Claro for manage fields which will likely need to be copied over/adapted.
Comment #38
lauriiiWhat are the next steps on this issue? It would be great to get this committed early in the release cycle.
Comment #39
jurgenhaas@lauriii I was planning to pick this up over the holiday period and get it ready for review by end-of-year or first week January.
Comment #40
jurgenhaasRebased the MR against main and changed the version here.
Comment #41
jurgenhaasAll tests are green except for that one I mentioned before, @berdir your suggestion didn't help I'm afraid.
Comment #42
catchThere are a couple of other CSS commits to Claro since November, e.g.:
Not sure whether these are relevant or not at this point, but in case they are.
Comment #43
lauriiiComment #45
phenaproximaFixed the last failing test.
The bug was due to a line that dates back to 2012 🤯 in the test, which creates a term whose
vidis 1.1?
Vocabulary IDs haven't been serial since Ye Anciente Times. How did this test ever pass? No idea. (I was there, Gandalf. I was there on that day 3,000 years ago...)
Anyway, creating an actual vocabulary and a term assigned to it (via
TaxonomyTestTrait) corrects the problem. Commit: https://git.drupalcode.org/project/drupal/-/merge_requests/13737/diffs?c...Comment #46
mgifford@phenaproxima what about all of these? https://www.drupal.org/project/gin/issues/3506302
Accessibility still matters in Core.
Comment #47
phenaproximaI have no opinion on that...? I was asked by @pameeela to resolve the failing test, so I did. If more things need doing in Gin before this is ready to go, so be it.
Comment #48
jurgenhaasThank you so much @phenaproxima for finding that issue with the test and fixing it. I've looked through the MR once again, and it's now ready for review.
Comment #49
catch@mgifford at least some of those issues also affect Claro, such as #3497077: dropdown buttons are broken with Javascript disabled. The split between Claro and Gin is IMO responsible for the lack of development of Claro in core as well as those accessibility issues building up in Gin over time.
The process of bringing Gin into core and unforking the themes (even though initially we'll have essentially three admin themes instead of two, we'll rapidly move towards the point of having one) should mean a lot more focus and attention goes into fixing them, the review that has happened since Gin was added to Drupal CMS has already improved things a lot.
Comment #50
pameeela commentedStrongly agree with @mgifford that accessibility matters in core, and also with @catch that merging this will get more attention on those issues, in addition to reducing the duplication of effort across multiple admin themes.
Incredible effort by @jurgenhaas to get this ready and many thanks to @phenaproxima for chasing down those last tests!
Comment #51
kentr commentedDoes this pass the core accessibility gate?
Comment #54
lauriiiExperimental themes (and modules) do not have to comply with core gates or be feature complete. The purpose of alpha experimental stage is to get initial reviews and start creating plans for feature completion and stability. For more information on the experimental process, you can refer to https://www.drupal.org/about/core/policies/core-change-policies/experime....
I discovered some small things that immediately jumped out as something that we need to improve. I will be filing follow-ups for those since it's easier to handle them in separate issues. I've committed this as alpha experimental to make the development easier.
Comment #56
kentr commented@lauriii Thanks!
FYI: It doesn't appear in the UI as experimental, and installing it doesn't give a warning.
Comment #57
mherchel@kentr if that's the case, we need a followup. Should be an easy fix.
Congrats everyone!
Comment #58
nicxvan commented#3576431: Mark new admin theme as experimental
Comment #59
acbramley commentedIt's probably a bit too late now, but I wish something this big would have had a bit more of a consensus with the community on naming.
Myself and at least a half dozen other contributors/maintainers (as seen in slack) aren't big fans of the machine name
adminTo me, this is a strange decision. Even if we're moving towards a single admin theme in core, the name admin just makes it difficult and confusing to talk about.
Grepping code and finding admin theme specific things also becomes a lot harder...
Comment #60
xmacinfoI agree. And I agree with all the reasons.
The rightful name of the Admin theme should be:
Core theme
Shall we open an issue?
Comment #61
catchThe general idea here is to try to centralise everything in a single admin theme across both core and contrib since duplication causes a lot of problems when trying to develop new administrative UIs. We would not prevent people from creating admin themes obviously, but we'll remove the selection in the UI and core features will work with the 'admin theme', and anything else will need to keep up etc. Just calling it 'admin' is a nod to that.
Having said that, opening an issue to change the name again seems fine - if we come up with something better that's great and should be a find and replace while it's still alpha.
Comment #62
pameeela commentedNo issue with changing the name either. “Core theme” strikes me as even more problematic though!
Comment #63
joachim commentedHave the accessibility and JS-degradation issues been fixed yet?
Comment #64
damienmckennaI opened #3576646: Rename Gin-based admin theme for the discussion around renaming the theme.
Comment #66
eduardo morales albertiCongratulation!!
Comment #67
gábor hojtsyMaintainers were not added to all the places. Opened #3578745: Add maintainers of Admin theme to MAINTAINERS.txt.