betterlt has undeclared dependency on "contextual" module and specific user configuration

Created on 28 June 2023, over 1 year ago

Problem/Motivation

On a site that does not use the Standard install profile, the Better Local Tasks CSS is not attached to page assets, unless I am logged in as user #1.

This is because the better_local_tasks_page_attachments_alter() function checks if the user has the permission "access contextual links". This permission is provided by the core module "contextual" - so if that module is not installed, no user/role is going to have it.

Steps to reproduce

  1. Install the Better Local Tasks module.
  2. Confirm the "contextual" module is not installed, or uninstall it.
  3. Log in as a user that is neither user #1 nor has the "administrator" role for the site.
  4. Observe unstyled BLT markup.

Proposed resolution

As far as I can see there is no reason to attach the library based on this permission from the contextual module.

Instead I would suggest the library be attached whenever the local tasks block is rendered.

Remaining tasks

Change the way the better_local_tasks/local-tasks library is attached.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bvoynick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024