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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Devin Carlson created an issue. See original summary.

Devin Carlson’s picture

A patch to reverse the current logic.

Devin Carlson’s picture

The last submitted patch, 3: 2771301-3-tests-only.patch, failed testing.

Devin Carlson’s picture

Status: Needs review » Fixed

Tested #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.

  • Devin Carlson committed fd76fd4 on 8.x-1.x
    Issue #2771301 by Devin Carlson: Reverse show/hide permissions
    
alexpott’s picture

Status: Fixed » Needs work

@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.

alexpott’s picture

I 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.

alexpott’s picture

Also this does not just affect user 1 it affects any user with the administrator role because they also automatically get the permission.

dragonwize’s picture

@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.

Alienpruts’s picture

I 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

B-Prod’s picture

The 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...

geek-merlin’s picture

+1 to for #12 approach, and remove insane negative permisisons.
Code looks straightforward.