Problem/Motivation

Spin-off from #2538970: Improve the speed of \Drupal\Core\Theme\ThemeAccessCheck

Theme negotiation checks 'access' to a theme, which is actually whether it is installed or not.

When looking at this, I wondered why it would be necessary to check there - shouldn't theme negotiators be responsible for returning a viable theme in the first place?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3584064

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

catch created an issue.

catch’s picture

OK so we do have test coverage of this - it deliberately returns a fake theme from a theme negotiator.

I'd be tempted to do the following:

1. Trigger a deprecation when a negotiated theme isn't installed, or maybe put the logic in an assert()?

2. In a later release remove the access check altogether and document that theme negotiators are responsible for returning a valid theme.

longwave’s picture

I think we could just put the logic in an assert and be done. Or even just throw an exception now? The use case of negotiating an invalid theme and expecting it to work in some way doesn't make sense to me.