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.
Problem/Motivation
ContextAwarePluginBase provides the method setContext()
as its primary setter.
It also provides setContextValue()
as a convenience method.
However, setContextValue()
currently bypasses setContext()
, so any class that wants to override one setter must override the other.
Proposed resolution
Make setContextValue()
use setContext()
internally
Remaining tasks
N/A
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#2 | 3014851-setcontextvalue-2-PASS.patch | 3.16 KB | tim.plunkett |
#2 | 3014851-setcontextvalue-2-FAIL.patch | 2.51 KB | tim.plunkett |
Comments
Comment #2
tim.plunkettComment #3
phenaproximaThis looks good and is both a nice clean-up, and a nice bug fix. A perfect example of why I always advocate for classes to call their own methods as often as possible.
RTBC when the fail patch is red and the pass patch is green.
Comment #5
alexpottAs an aside it's interesting that
setContextValue()
returns$this
andsetContext()
does not.Comment #6
alexpottCommitted and pushed 7dcb927309 to 8.7.x and 136dd9ed0b to 8.6.x. Thanks!
Comment #10
tim.plunkett