Problem/Motivation

See #3566536: [meta] eliminate core .module files

Proposed resolution

  • Create a new service Drupal\block\BlockTheme
  • Move the logic of block_theme_initialize() to \Drupal\block\BlockTheme::themeInitialize()
  • Deprecate block_theme_initialize()

Remaining tasks

None.

User interface changes

None.

Introduced terminology

None.

API changes

  • New service Drupal\block\BlockTheme</code > with <code>::themeInitialize() method.
  • block_theme_initialize() is deprecated for removal in 12.0.0

Data model changes

None.

Issue fork drupal-3566782

Command icon Show commands

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

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Issue summary: View changes

Fix IS

claudiu.cristea’s picture

Issue summary: View changes

nicxvan’s picture

At a high level this looks good, I updated the change record to match what I usually see for deprecated functions.

claudiu.cristea’s picture

Assigned: claudiu.cristea » Unassigned
Status: Active » Needs review

Ready for review

claudiu.cristea’s picture

OK, went with the proposal from @berdir and @nicxvan. Ready for e new review round

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

Got sign off on deprecating this way from @tim.plunkett the block module maintainer.

This MR is now fairly minimal and I think looks good

I confirmed the CRs point to the right place, versions are correct too.

There are no uses in contrib that I could find.

berdir’s picture

There's also an issue that discusses removing this functionality completely, although I don't fully agree with that. Might want to make a decision on that first before moving it to avoid duplicate work: #3105597: Stop copying block configuration from active theme when enabling a new theme?

claudiu.cristea’s picture

I think #3105597: Stop copying block configuration from active theme when enabling a new theme is the kind of issue which will take more time to get a decision because it's a business/functional issue. This is just a deprecation and refactoring. I would not block on that.

nicxvan’s picture

Thank you, I am aware of that issue, this issue only makes that easier to remove if that is the decision made. Let's not block this on that.

berdir’s picture

That's fine, the reason I brought it up is that I'm a bit concerned about the RTBC queue. It's long and these .module cleanup issues are adding quite a bit to that. The main bottleneck that we need to optimize for I think is the RTBC queue and less our own time.

But yes, that one needs a product or framework maintainer decision I guess and that's essentially the same people.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs review

Is there any chance we could, instead, deprecate this function outright with no replacement?

I explained my rationale in this rant comment: #3105597-33: Stop copying block configuration from active theme when enabling a new theme

Long story short, I think block_theme_initialize() is an oudated, confusing function from another era, whose behavior looks like a bug, and we should just toss it. Thoughts?

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

It already is deprecated without replacement.

The functionality itself would be removed in the issue you linked.

See 9-12

Restoring status.

phenaproxima’s picture

Well...yeah, the function is deprecated without a replacement, but if we proceed with this MR as-is, then we have a whole other protected method to deprecate when we want to remove the functionality itself. What I'm wondering is, what if we combined this issue with that one, moving the function into a protected method and deprecating that protected method?

But it seems like the decision has been made in #9-#12, so I'm not going to (no pun intended) block it.

nicxvan’s picture

but if we proceed with this MR as-is, then we have a whole other protected method to deprecate when we want to remove the functionality itself.

Protected functions like that should be able to be removed outright.
The reason I didn't do that is I think there is an open question about whether we can drop it entirely.

If that one lands first it makes this moot, if this one lands first it makes the other easier.

  • longwave committed 38f070c8 on 11.x
    refactor: #3566782 Deprecate block_theme_initialize() and move the logic...
longwave’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Yep if we decide we don't want that method any more we can just drop it in future now it's been moved inside the class.

Committed and pushed ac357941fe8 to main and 38f070c8b85 to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • longwave committed ac357941 on main
    refactor: #3566782 Deprecate block_theme_initialize() and move the logic...

longwave’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.