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 mentioned on the project page and in the documentation, Better Formats allows users to hide a number of elements including format tips, format tips link and format selection. However, the current logic disables all of these elements as soon as the module is enabled and then requires administrators to enable them.
Reversing this logic would bring the permissions inline with the documentation, provide a less-jarring installation experience and allow us to repurpose existing core tests without having to make numerous overrides.
Comment | File | Size | Author |
---|---|---|---|
#12 | better_formats-reverse-show-hide-permissions-2771301-12.patch | 6.03 KB | B-Prod |
#3 | 2771301-3.patch | 13.88 KB | Devin Carlson |
| |||
#3 | 2771301-3-tests-only.patch | 9.21 KB | Devin Carlson |
Comments
Comment #2
Devin Carlson CreditAttribution: Devin Carlson commentedA patch to reverse the current logic.
Comment #3
Devin Carlson CreditAttribution: Devin Carlson commentedUpdated tests.
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedTested #3 and committed to Better Formats 8.x-1.x.
The ability to disables all of these elements for all entity types could be added as an option on the settings page if there is enough interest.
Comment #7
alexpott@Devin Carlson I don't think this has achieved what is desired. Having a negative permission breaks the site horribly for user 1. It also kinda breaks the idea of granting someone a permission to be allowed to do something. I think this needs a re-think.
Comment #8
alexpottI think a better fix would be to have a hook install that grants the "show" permissions to the existing roles on the site. That way user 1 is not broken, the site is not drastically changed on install, and we can still configure this the same way.
Comment #9
alexpottAlso this does not just affect user 1 it affects any user with the administrator role because they also automatically get the permission.
Comment #10
dragonwize CreditAttribution: dragonwize commented@alexpott & @Devin Carlson I agree with alexpott and that is how it was done in D6 version of the module. Not sure why it never made it into the other versions.
Comment #11
Alienpruts CreditAttribution: Alienpruts commentedI agree that this change, how noble its intent was, has actually made using it as the administrator user a bit ... buggy :)
See for more information :
https://www.drupal.org/node/2791203#comment-11630753
Comment #12
B-Prod CreditAttribution: B-Prod commentedThe patch below changes all the defined permissions so they do not intend to hide but yo show.
This solves issues with the root user and the admin roles.
To keep consistency, the
hook_install
grants all permissions to the non-admin users, so the Drupal default behaviour is not changed on installation.I tried to work on a
hook_update in order to update the permissions on existing sites, but I didn't find a way to retrieve the old permissions, as they no more exists. If anyone has an idea to fix this or a workaround...
Comment #13
geek-merlin+1 to for #12 approach, and remove insane negative permisisons.
Code looks straightforward.