Problem/Motivation
ThemeManagerInterface getActiveTheme parameters do not match ThemeManager.
\Drupal\Core\Theme\ThemeManager::getActiveTheme():
/**
* {@inheritdoc}
*/
public function getActiveTheme(RouteMatchInterface $route_match = NULL) {
if (!isset($this->activeTheme)) {
$this->initTheme($route_match);
}
return $this->activeTheme;
}
\Drupal\Core\Theme\ThemeManagerInterface::getActiveTheme():
/**
* Returns the active theme object.
*
* @return \Drupal\Core\Theme\ActiveTheme
*/
public function getActiveTheme();
Proposed resolution
Change \Drupal\Core\Theme\ThemeManagerInterface::getActiveTheme()'s signature to match ThemeManager's signature.
Remaining tasks
User interface changes
API changes
ThemeManagerInterface method signature changes from:
getActiveTheme()
to
getActiveTheme(RouteMatchInterface $route_match = NULL)
However this is allowable under the 1-1 rule for interfaces.
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | interdiff-2-4.txt | 544 bytes | hardik_patel_12 |
| #4 | 3160307-4.patch | 906 bytes | hardik_patel_12 |
| #2 | 3160307-2.patch | 892 bytes | jungle |
Comments
Comment #2
jungleComment #3
kristen polThanks for the issue and patch.
1) Patch applies cleanly.
2) Tests pass.
3) Looking for all
getActiveThemefunctions, I see:where
ThemeInitializationparameters matchThemeInitializationInterfaceandTwigExtensiondoes not have a Drupal interface defininggetActiveTheme. From this, onlyThemeManagerInterfaceneeds updating per the issue summary.4) After patching, the parameters match.
5) Looking at other doc blocks with RouteMatchInterface params, it looks like it should be updated to include the namespace.
I would change
RouteMatchInterfaceto\Drupal\Core\Routing\RouteMatchInterface.6) Also, most core code uses
The route match.rather thanThe route match object.so I would change this as well.Comment #4
hardik_patel_12 commentedUpdating @param comments for getActiveTheme function , kindly review.
Comment #5
kristen polReviewing this for DrupalCamp Colorado contribution day.
Comment #6
kristen polThanks for update. Marking RTBC based on the following and #3.
1) Patch still applies cleanly.
2) Tests pass and additional tests are not needed.
3) Changes in #4 address items in #3.
4) Title and issue summary have been updated for clarity.
Comment #7
dwwDoes this need a CR?
Otherwise, RTBC +1.
Thanks,
-Derek
Comment #8
larowlanI traced the lineage of this.
The original interface and theme manager went in with #2228093: Modernize theme initialization.
This issue existed in that original issue, so they were divergent from the onset.
I checked for both 'implements ThemeManagerInterface' and 'extends ThemeManagerInterface' in http://grep.xnddx.ru - and there were no results.
However, this doesn't mean there is another implementation in some-one's custom project.
And unfortunately, this change would break that - see here https://3v4l.org/JeoS4
So I don't think we can do this without a BC break.
I'll poll other committers, but I think this will have to be closed won't fix and filed under technical debt. Postponing to poll other committers.
edit this might come in under our 1:1 rule
Comment #9
larowlanUsing NR instead, as I think this might come in under the 1:1 rule
Comment #10
catchI think this is OK under the 1:1 rule, especially given there's no sign of anyone implementing the interface.
The other option would be to add the parameter commented out, with a note that it will be part of the interface in 10.0.x and do the bc break then, but that seems unnecessary here.
Comment #13
quietone commentedWhat is the next step here?
Comment #14
kristen polGiven the explanation in #10, moving back to RTBC.
Comment #15
catchYeah I think this is fine.
We needed a change record, which I've added here: https://www.drupal.org/node/3213807
Committed e821dc5 and pushed to 9.3.x. Thanks!
Not backporting to 9.2.x or earlier - don't think we need to and in the unlikely event that there is contrib/custom code broken by this, gives more time to find out.
Comment #17
catch