Merge Requests

More

Recent comments

🇺🇸United States nicxvan

Just one final comment that I think needs addressing.

🇺🇸United States nicxvan

My questions were answered I'll do a more thorough review later unless someone else gets to it.

🇺🇸United States nicxvan

Did a quick review, a few questions where I feel like I'm missing something obvious.

🇺🇸United States nicxvan

Unfortunately lots of failures that seem relevant, have not reviewed any.

🇺🇸United States nicxvan

The coding standard issue is RTBC

🇺🇸United States nicxvan

I think with three supporters we can RTBC this.

I updated the IS with the new language.

🇺🇸United States nicxvan

Thinking about your feedback on:

  if (!defined('MARK_READ')) {

vs

  if (!in_array(\DRUPAL_ROOT . '/core/includes/theme.inc', get_included_files())) {

This check is needed for just one test where preprocess functions are not loaded yet.

This whole stanza only gets hit during site install so there are no performance implications there.
However during tests every time drupal is installed we'll hit this and have to check.

It's a small thing, but I think checking the const is probably less intensive than the get_includes check. They both accomplish the same thing. Is it worth changing that back?

🇺🇸United States nicxvan

Addressed your feedback, left a comment on one.

🇺🇸United States nicxvan

Applied three and responded to one comment.

🇺🇸United States nicxvan

nicxvan changed the visibility of the branch 3487957-convert2.0 to hidden.

🇺🇸United States nicxvan

@andypost, I don't think we can add that until https://www.drupal.org/project/coding_standards/issues/2999367 Require using a colon after case instruction in switch statements Active is resolved.

This fixes the current inconsistencies, then we need that other issue, can you review that one? I think it has the supporters needed.

🇺🇸United States nicxvan

I added a procedural test too.

🇺🇸United States nicxvan

Ok this is ready for review.

I ran the test only, but that won't fail cause the current code and previous code both work for the situation, but it will prevent the regression.

🇺🇸United States nicxvan

I'm taking a crack at this.

🇺🇸United States nicxvan

Having worked with this for a bit, this isn't the right issue for what I mentioned in 42.

I'm doing a review now.

🇺🇸United States nicxvan

If you extend it and set it as a decorator the original event listener tags move over as well.

Also, yes if multiple interact it would probably get messy quick, but in order to prevent that what do we lose?

🇺🇸United States nicxvan

I've refactored this to be closer to the way it originally worked.

The one change is now the installer loads only the minimal needed to work.

🇺🇸United States nicxvan

Yes that is what it should look like.

🇺🇸United States nicxvan

Oh yeah we also have to get rid of hook info and replace hmia too.

🇺🇸United States nicxvan

Yes 11.x

Since that is the version selected in the issue now if you click create new branch it should auto select that one to cut from.

🇺🇸United States nicxvan

Just commenting to say it's simple to change php or even mysql or mariadb versions in ddev too.

🇺🇸United States nicxvan

I can't edit it for some reason.

🇺🇸United States nicxvan

Not sure if I agree with marking hook classes as final.

Until we have a proper way to handle replacement long term I think it's better to leave them not final.

🇺🇸United States nicxvan

Looks good to me, all cron hooks have : void.

🇺🇸United States nicxvan

nicxvan changed the visibility of the branch project-update-bot-only to hidden.

🇺🇸United States nicxvan

nicxvan changed the visibility of the branch 3488176-convert-systemtheme-to to hidden.

🇺🇸United States nicxvan

Just to clarify, whether those code style changes are acceptable here is up to the maintainer. It's not an inherent issue.

If you're ok with addressing code style issues here too then we can review it as is.

🇺🇸United States nicxvan

If we do not want to remove the system theme hook entirely then we will likely need to special case the install and load what is needed for the installer to work.

It might be more desirable to approach it this way cause then system_theme stays the same but it's OOP.

The issue is two fold.

1. The class is not loaded during install so the OOP hook will not be there. The procedural hook is still picked up in that situation though.
2. The RegistryTest does some funky stuff and Drupal is not fully there during that test.

What is in this pr bypasses those two issues, but we no longer have a system_theme hook implementation at all and we're loading the templates somewhat manually.

🇺🇸United States nicxvan

I created a new one because I don't like pushing to the project bot only branch and we had to rebase cause the paragraphs issue also created the composer.json.

I'm happy to close mine.

Looking briefly at the new one, it has a lot of changes unrelated to drupal 11 support: 43 files + 624 − 661.

Whether that is acceptable is left up to the maintainers, but that is a lot more to review than the changes in my MR, though my MR still needs the jquery dependency issue resolved.

🇺🇸United States nicxvan

Let me know if this requires a CR.

🇺🇸United States nicxvan

Ok let me update those.

🇺🇸United States nicxvan

The current issue seems to be that for some reason $this->moduleList->getPath('system') does not return the path to system, so when the preprocess hook process runs it doesn't have the path to the templates.

So then later on when they are diffed $diff = array_diff($parent_hook['preprocess functions'], $cache[$source_hook_name]['preprocess functions']); it fails on container since the templates have not been crawled.

At least this is what I think is happening.

🇺🇸United States nicxvan

Do you just want the class comments updated?

How about something like:

This class will not have an effect until Drupal 11.1.0.

This class is to prevent phpstan errors for modules that support procedural and #Hook implementations.

🇺🇸United States nicxvan

nicxvan changed the visibility of the branch 3487971-convert-remaining-two to hidden.

🇺🇸United States nicxvan

I'm going to split system_theme out of this cause that has gone a bit far afield.

🇺🇸United States nicxvan

Each baseline item is 6 lines too, that means you've eliminated over 4800 lines from baseline with another 3000 to go!

🇺🇸United States nicxvan

@berdir is mostly correct. The one additional thing I might consider here are child tasks to eliminate module .inc files.

They used to be useful from a pure organization standpoint, but now many have just a couple preprocess functions and with the .module files so much shorter it may make sense to consolidate some.

This title may be better called something like evaluate core .inc files in modules.

🇺🇸United States nicxvan

Looks good!

Great catch on the ones that returned values.

🇺🇸United States nicxvan

To answer my own question it is about the return of hook theme.

I prefer TemplateDefinition over TemplateImplementation

🇺🇸United States nicxvan

The root of the issue for system_theme is that when Registry is called during install processExtension doesn't register system_theme as a hook when it's an object, but it does for the function even though the invoke call doesn't use the legacyInvoke fallback.

I then moved it to a static method so I could add it when needed, and combined system_theme and drupal_common_theme since that was the only call to drupal_common_theme (though that might be like that to load the constants in theme.inc)

🇺🇸United States nicxvan

Yeah, this was cause there are some wider things for deprecating hook_hook_info. This might become unnecessary though.

🇺🇸United States nicxvan

I might split out the page attachments from system_theme

Page attachments is pretty straightforward.

system_theme is getting a bit complicated I fixed the install process, RegistryTest will likely fail still.

I imagine it needs some discussion.

🇺🇸United States nicxvan

nicxvan created an issue.

🇺🇸United States nicxvan

For some reason some use statements are being duplicated.

🇺🇸United States nicxvan

nicxvan changed the visibility of the branch 3487957-convert-to-oop to hidden.

🇺🇸United States nicxvan

nicxvan created an issue.

🇺🇸United States nicxvan

Also, if we want to prioritize .install etc, there is a path we can take where we just have a special serviceProvider like class for the install time ones, we don't get the true benefits of OOP, but it would still give some organization options and we could deprecate .install files at that point.

I think these are the ones in .install still:
* - hook_install()
* - hook_post_update_NAME()
* - hook_schema()
* - hook_uninstall()
* - hook_update_last_removed()
* - hook_update_N()

These are sometimes in .install, but they already support OOP
* - hook_module_preinstall()
* - hook_module_preuninstall()
* - hook_modules_installed()
* - hook_modules_uninstalled()

Once that is broken down it would make it easier to scope out how to truly convert those hooks.

The really big hurdle I think just from an amount of code in .module files is handling:

  • hook_preprocess_HOOK
  • hook_process_HOOK
  • hook_theme_suggestions_HOOK

As well as handling hooks called from themes, if we solve those two things that covers like 80% (made up percentage) of the remaining code in .module files I think, most everything else in my experience are helper methods that are in .module for convenience and can be moved, or things for batch / queues, but those already have a way to move.

🇺🇸United States nicxvan

Hook collector picks up all functions that start with module name.

🇺🇸United States nicxvan

Not quite, but close.

I think we need to figure out follow up 2 here: https://www.drupal.org/project/drupal/issues/3472165 📌 [PP-1] Explore converting Install hooks to OOP Active

Then we need to figure out how in themes / on behalf of themes.

Hook hook info
Hook module implements alter

And where to put cost and define statements.

Then we can.

I think we're close to deprecating .inc

We just have to figure out the three helpers for views and Hook Hook info for that I think https://www.drupal.org/project/drupal/issues/2233261 📌 Deprecate hook_hook_info() Active

🇺🇸United States nicxvan

If you click on it and search for fail you can find the failures.

It's layout builder which is a known common failure.

If you click get push access you can run that test group.

🇺🇸United States nicxvan

Also, only slightly related, but I think I'm going to create a cleanup meta now that core is converted to clean up some inc and module files that only really have constants or a single helper function.

🇺🇸United States nicxvan

📌 Deprecate Procedural hook implementations Active is a super naive implementation of this. Chx pointed out this is to expensive to really do it this way most likely.

I plan on cleaning up my conversion script for contrib over the next week or so.

🇺🇸United States nicxvan

Not unless there are other issues brought up, but it might be a while for a few reasons so please be patient.

First we're in the beta window so the core team is focusing a lot of efforts on some initiatives around that.

It can sometimes take a few weeks for an issue to get merged in.

🇺🇸United States nicxvan

I created 📌 [ignore] Test Filecache Active we can apply this there

🇺🇸United States nicxvan

These changes look good to me actually, can we test this against XB before going through the commit process again?

🇺🇸United States nicxvan

Just a quick note, you can implement on behalf of other modules using #[Hook('toolbar_alter', module: 'module_on_behalf_of')]

You can't implement on behalf of a theme though.

Production build 0.71.5 2024