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.
As a follow up to #1826602: Allow all configuration entities to be enabled/disabled, Let's add a setStatus() method on configuration entities. enable/disable methods would then just wrap this.
Here is an initial patch. It just adds this as a method to ConfigEntityBase, no interfaces etc..
I guess the question is do we want this to be a part of the ConfigEntityInterface? This could mean all of them, or remove enable/disable and just have setStatus in the interface.
Comment | File | Size | Author |
---|---|---|---|
#16 | 1911814-16.patch | 1.88 KB | damiankloip |
#16 | interdiff.txt | 549 bytes | damiankloip |
#15 | drupal-1911814-15.patch | 1.84 KB | dawehner |
#15 | interdiff.txt | 551 bytes | dawehner |
#14 | drupal-1911814-14.patch | 1.87 KB | dawehner |
Comments
Comment #0.0
damiankloip CreditAttribution: damiankloip commentedUpdated issue summary.
Comment #1
tim.plunkett@param
Should have a line after it explaining
If we want calling code to be able to rely on enable/disable, they should stay in the interface. So I vote for all three in there.
Comment #2
damiankloip CreditAttribution: damiankloip commentedYeah, I'm not sure about having all of them but I don't mind either way. Here is a new patch that adds setStatus() to the interface.
Comment #3
damiankloip CreditAttribution: damiankloip commentedComment #4
dawehnerThis @return should be actually on the interface
Comment #5
damiankloip CreditAttribution: damiankloip commentedI was thinking that, but does it have to return $this? People might want to implement this slightly differently at some point? not sure.
Comment #6
dawehnerWell, it should be at least consistent, as you might want to switch out the internal implementation of the class.
Being able to chain stuff is great, so it would makes sense to force it.
Comment #7
damiankloip CreditAttribution: damiankloip commentedSold! I've moved it to the interface :)
Comment #8
dawehnerOpened #1912544: [policy, then patch] Use @return $this to mark that a method returns itself to make it a bit easier to document what is going on.
Comment #9
webchickCommitted to 8.x, thanks! Will push once testbot's calmed down a bit. :)
Comment #10
alexpottThis patch is causing me local fails due to
Afaik I know scalar's can not be type hinted so:
should not have the
bool
Comment #11
alexpottHere's a patch to remove the type hinting.
Comment #12
dawehnerPlease let's also fix the ViewUI class, as it fails pretty hard as well.
Adapting stuff :(
Comment #13
dawehnerWrong patch.
Comment #14
dawehnerdoh
Comment #15
dawehnerDamian pointed out another issue with that.
Comment #16
damiankloip CreditAttribution: damiankloip commentedLooks good to me, I have just added casting for the actual $status variable inside the method instead. These tests are passing fine for me locally now.
Comment #17
dawehner+1 for that change.
Comment #18
webchickOops. :\ Sorry, guys.
Committed and pushed to 8.x. Thanks for finding this quickly!!
Comment #19.0
(not verified) CreditAttribution: commentedUpdated issue summary.