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 of #2308745: Remove rest.settings.yml, use rest_resource config entities, it's actually possible to really disable REST resources: you can call RestResourceConfig->disable()
on it now. We still need to fix a bug in core to actually make that work as expected (#2844046: REST Resource config entities do not respect the status (enabled/disabled)), but then it will work.
- Disabling = keep the configuration, but it's not active; it accepts no requests.
- Deleting = delete the configuration forever.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2851126-4.patch | 1.72 KB | Wim Leers |
Comments
Comment #2
Wim LeersThis is blocked on #2844046: REST Resource config entities do not respect the status (enabled/disabled), which is blocked on #2815845: Importing (deploying) REST resource config entities should automatically do the necessary route rebuilding.
Comment #3
Wim Leers#2815845: Importing (deploying) REST resource config entities should automatically do the necessary route rebuilding landed, so this is blocked less now :)
Comment #4
Wim Leers#2844046: REST Resource config entities do not respect the status (enabled/disabled) also landed, so this is unblocked too.
I wanted to change
to . But then that is much scarier. So… what if instead, we make actually disable, and make create it if it doesn't exist, and enable if it does already exist? Actually, that's already the logic that\Drupal\restui\Form\RestUIForm::submitForm()
contains, so there's nothing new here. We're just making the UI actually do what it was claiming to do.This patch tries to minimize the number of changes.
Comment #5
rogierbom CreditAttribution: rogierbom at Synetic commentedI agree. Deleting the configuration has more impact than just disabling it, and should IMHO be confirmed by the user first. It would be better to create a separate issue the add the delete action, with everything that comes with it.
Tiny nitpick with the patch: why not use fluent interface when enabling the resource, like it is done when disabling?
Comment #6
rogierbom CreditAttribution: rogierbom at Synetic commentedComment #7
Wim LeersBecause the existing code doesn't do that either. The style in this patch is consistent with the existing code.
I totally agree we should fix that, but that entire file needs a serious refactoring wrt code style.
Comment #8
rogierbom CreditAttribution: rogierbom at Synetic commentedAgreed, let's keep the refactoring separated. In that case the patch is OK!
Comment #10
clemens.tolboomComment #11
Wim LeersYay :)