Problem/Motivation

Follow-up from #2659940: Extension System, Part III: ThemeExtensionList and ThemeEngineExtensionList

Steps to reproduce

NA

Proposed resolution

NA

Remaining tasks

Review CR and MR

User interface changes

NA

API changes

Deprecate \Drupal\Core\Extension\ThemeHandlerInterface::getBaseThemes()

Issue fork drupal-2972153

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

markcarver created an issue. See original summary.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alexpott’s picture

Status: Active » Needs review
Issue tags: +Needs change record updates
StatusFileSize
new5.04 KB

I think the whole concept of getBaseThemes() on both the ThemeHandler and the ThemeExtensionList is not needed. The function signature of having to provide a list of themes to search for sub themes is very odd because both of these things have lists of themes ?!!?

I think this probably needed before we had \Drupal\Core\Theme\ActiveTheme::getBaseThemes() but it appears obsolete now.

andypost’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Extension/ThemeExtensionList.php
@@ -194,8 +194,14 @@ protected function fillInSubThemeData(array &$themes, array $sub_themes) {
   public function getBaseThemes(array $themes, $theme) {
+    @trigger_error("\Drupal\Core\Extension\ThemeHandlerInterface::getBaseThemes() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There is no direct replacement. See https://www.drupal.org/node/2709919.", E_USER_DEPRECATED);

+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -165,6 +165,7 @@ public function rebuildThemeData() {
   public function getBaseThemes(array $themes, $theme) {
+    @trigger_error("\Drupal\Core\Extension\ThemeHandlerInterface::getBaseThemes() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. There is no direct replacement. See https://www.drupal.org/node/2709919.", E_USER_DEPRECATED);

error in "list" message - copy/paste from handler

andypost’s picture

Looks there's no need at all in gathering base themes

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new2.04 KB
new5.03 KB

Nice catch.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new4.2 KB

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dimitriskr made their first commit to this issue’s fork.

dimitriskr’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

For good practice we should still use the standard issue summary template.

dimitriskr’s picture

Issue summary: View changes
dimitriskr’s picture

Status: Needs work » Needs review
Issue tags: -Needs issue summary update
smustgrave’s picture

Status: Needs review » Needs work

Still is tagged for change record updates from a few years back.

dimitriskr’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record updates

Updated the CR too

smustgrave’s picture

Status: Needs review » Needs work

So I think this needs it's own change record.

The current one is published and said it was introduced in 8.7 which isn't the case for this. So methods have been deprecated in 8.7 and no 10.3 I'm just worried that would be confusing.

Will post in slack also.

dimitriskr’s picture

Issue tags: +Needs change record
quietone’s picture

Yes, this should have it's own change record. Any changes to the original change record should be moved to the new one so that the dates and version/branch of each change record is correct.

dimitriskr’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs change record

Updated remaining tasks in IS

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Additional CR looks fine, made some tweaks to make it clear when it was deprecated and removed.

longwave’s picture

Status: Reviewed & tested by the community » Needs review
is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0

What is the reason for keeping this until Drupal 12? We are OK to deprecate in 10.3.0 for removal in 11.0.0, except where we think things might be widely used or difficult to remove, but this one looks straightforward.

smustgrave’s picture

Status: Needs review » Needs work

Believe there is a slack discussion around this. But moving to NW as the MR is unmergable.

kostyashupenko made their first commit to this issue’s fork.

kostyashupenko’s picture

Status: Needs work » Needs review

Resolved conflicts / rebased

dimitriskr’s picture

Status: Needs review » Needs work
dimitriskr’s picture

Status: Needs work » Needs review

Edit: removal stays in D12

Spokje made their first commit to this issue’s fork.

andypost’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Applied a simple :void to the test, but deprecation seems correct.

longwave’s picture

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

Committed and pushed 1e80a22b06 to 11.x and 5e778473f4 to 10.3.x. Thanks!

Also published the change record.

  • longwave committed 5e778473 on 10.3.x
    Issue #2972153 by dimitriskr, alexpott, smustgrave, andypost,...

  • longwave committed 1e80a22b on 11.x
    Issue #2972153 by dimitriskr, alexpott, smustgrave, andypost,...

longwave’s picture

Status: Reviewed & tested by the community » Fixed
longwave’s picture

Version: 11.x-dev » 10.3.x-dev
longwave’s picture

Third time lucky, issue credits got swallowed up by d.o somehow.

Status: Fixed » Closed (fixed)

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

nitesh624’s picture

We are also using this function in our custom module. But after deprecation there are no replacements suggested here.
So Is there any alternate workaround to achieve this?

andypost’s picture

Before looking for workarounds please consider if you really need this method as it very internal to ThemeExtensionList::doGetBaseThemes() which you can decorate/access in a hacky way

But custom code is not expected to use this method

nitesh624’s picture

Thanks for reply andy.
Yes for our use case it might be needed as we are creating some predefined block based to the base theme condition in hook_theme_installed() hook.

joseph.olstad’s picture

Hmm, my theme is heavily using the getBaseThemes and I would like to avoid a major refactor. So you're saying it's possible to decorate ThemeExtensionList::doGetBaseThemes() in order to do what getBaseThemes does?

I'm seeing doGetBaseThemes in core/lib/Drupal/Core/Extension/ThemeExtensionList.php

and there's a test for it in core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php

Makes me wonder what the rationale for this change is/was?

***EDIT***
I was hoping to use the russian Drupal code grepper to find usages elsewhere but it's currently offline. Other search tools available for contrib are a bit clunky and slow.
***END EDIT***