Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
render system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2019 at 15:00 UTC
Updated:
17 Jan 2023 at 11:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
niklanComment #3
niklanPatch for tests.
Comment #4
niklanTrigger patch
Comment #5
chi commentedSeems like a relic from Drupal 7.
Comment #6
alexpottNice find!
Unless this is broken code this needs to go through the deprecation process as this is a plugin and potentially could be being used by contrib or custom code. Deprecating would mean overriding the constructor and throwing an @trigger_error() in there. And adding a @deprecated doc tag to the class docs.
Comment #7
niklanAdded deprecation comment and notice in the constructor.
Comment #8
init90Thanks! I've found one small moment which need to fix. In Drupal coding standards is recomendation about parametrs order in docblock:
https://www.drupal.org/project/drupal/issues/3067580 section "Drupal API documentation standards for order of documentation sections"
Would be good apply it to the patch.
Comment #9
chi commentedDoes anyone know how to make use of this element in Drupal 8? If this is a dead code from Drupal 7 there is no need in deprecation process and change record.
Comment #11
andypost1748 failed tests means it used somehow
Comment #12
tim.plunkettAs #3 shows, removing it passes tests.
The problem is that on a cold cache, all RenderElement plugins are instantiated and their
getInfo()method is called.I'm not sure how best to indicate deprecations of these plugins... Maybe a #deprecated = TRUE flag or something.
Comment #13
wim leersNice find indeed!
Comment #14
tim.plunkettFor the record, the last usage of this was removed in #1957590: Remove remaining procedural ajax command usages., April 2013. 381 commits before 8.0-alpha1!
Comment #15
wim leers😮
Nice git archeology work!
Comment #16
andypostAdded initial CR https://www.drupal.org/node/3068104
Patch introduce "deprecated" annotation for elements plugins as #14 suggested and fixed deprecation message
Comment #17
alexpottThis doesn't work - we need deprecated definitions to be findable.
Comment #18
alexpottHere's a patch based on a comment from @andypost online.
We need to add tests how this works but it should allow us to build element info and use the current plugin deprecation standard (i.e. @trigger_error in the constructor).
Comment #19
alexpottHere's a test/
Comment #20
alexpottFixed up the deprecation message. We can add an @see if we feel a change record is warranted. @tim.plunkett what would a CR say?
Comment #21
chi commentedIs this a new format for referencing Drupal versions in deprecation messages? It used to be "Drupal 8.8.0".
Comment #22
alexpottOops there is a CR already. Nice. Added it to the deprecations. @Chi yes this is the format.
Comment #23
alexpottHmmm... so I've tested whether or not the Ajax element works. And it doesn't. It is totally busted. I set up a controller to do:
And the only JS loaded on the page is
So I ponder if the CR is even worth it and if removing it isn't actually the right thing.
Comment #24
andypostThis element does not work, so probably removal is better choice
Could use
__CLASS__Comment #26
andypostComment #32
pooja saraah commentedAddressed the comment #24
Attached patch against Drupal 10.1.x
Comment #33
andypostDeprecation messages also needs update to 10.1 and 11.0 from 8 and 9
Comment #34
pooja saraah commentedComment #35
pooja saraah commentedFixed failed commands on #32
Addressed the comment #33
Attached interdiff patch
Comment #36
pooja saraah commentedComment #37
andypostHere's a fix, also it needs extra test case for the deprecated
AjaxclassMaybe extra CR needed to announce ability to deprecate elements
since PHP 8.0 $context is removed https://www.php.net/manual/en/function.set-error-handler.php that's why
Comment #38
andypostand will need postponed issue to remove the element
Comment #39
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
Reviewing #37
Deprecation message appears correct
Applies cleanly locally.
Verified test fails and passes with the deprecation fix.
CR looks good.
+1 for me
Unless you meant in #38 this should be postponed?
Comment #41
catchShame we have to do this but the only way around it would seem to be moving ::getInfo() to attributes or something. Not for here.
Everything looks good to me. I don't think we need an explicit postponed issue to remove this, we can do it as part of the general 'remove deprecated stuff' Drupal 11 issues.
Committed d4da802 and pushed to 10.1.x. Thanks!
Comment #42
alexpottWe could keep that code and the test for it there - so contrib can deprecate render elements too.
Alternatively we could deprecate not having getInfo() as a static method - or we could even try to move getInfo() into PHP attributes somehow - although things like the date format loading in \Drupal\Core\Datetime\Element\Datetime::getInfo() are likely to be tricky but we could have an alter or something similar for that.