Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
i seriously doubt anyone would ever need this feature:)
Lets not register those to the classloader please
Comment | File | Size | Author |
---|---|---|---|
#5 | drupal-classloader_themes-2070581-5.patch | 1.62 KB | ParisLiakos |
#2 | drupal-classloader_themes-2070581.patch | 503 bytes | ParisLiakos |
Comments
Comment #1
dawehnerRelated issue #2002606: Allow themes to provide services.yml
Comment #2
ParisLiakos CreditAttribution: ParisLiakos commentedi think keeping the drupal_get_filename() call though is good, so lets keep call system_register
lets see if something breaks
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedso we actually have a test for this;)
Drupal\system\Tests\Theme\ThemeTest->testClassLoading()
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedComment #7
Berdir#5: drupal-classloader_themes-2070581-5.patch queued for re-testing.
Comment #8
longwaveThe test was deliberately added in #1538478: Register lib/ directories of themes as PSR-0 roots for Drupal\$theme namespace, and back then it was decided that themes *should* be able to autoload classes if they need them. What benefits do we get from removing this?
Comment #9
iamEAP CreditAttribution: iamEAP commentedRelevant discussion from #8:
Crell:
sun:
Comment #10
xjmThe patch here couldn't be automatically rerolled for #2247991: [May 27] Move all module code from …/lib/Drupal/… to …/src/… for PSR-4 (the only one among best-guess patches that apply), but it sounds like maybe this issue is a wontfix anyway?
Comment #11
xjmChanged my mind; not tagging based on #8 and #9.
Comment #12
markhalliwellSigh... I really cannot wrap my head around why themes are consistently targeted as "lower class". This mentality has to stop. Seriously.
They have PHP code and I don't see that going away anytime soon. Until themes don't have a single line of PHP code, something like this should never be added.
Limiting a theme's ability to utilize native and fundamental PHP syntax just because they haven't been using them is extremely presumptuous.
The primary reason themes haven't used namespaces in the past is because 7.x didn't support them out-of-the-box and would require themes to add a module dependency (which is very difficult to support in a theme).
Thus, namespaces really hasn't be an "official thing" until 8.x and I, for one, am rather excited to start using them to finally organize and OO some of the Bootstrap base theme's code.
So, as a themer and maintainer of one of the top d.o themes, I'm marking this as "won't fix".