Problem/Motivation

Toastify is a good fit for our front-end theme, but it's not so welcome in the admin theme (a lightly css-enhanced Claro). We'd like messages in the admin theme to be unaltered.

It doesn't appear to be possible to disable Toastify entirely for a single theme. The class swap in hook_element_plugin_alter() is cached regardless of theme.

Setting toastify/toastify: false in libraries-override results in no messages appearing at all, presumably because the class is swapped and expects the library to be there.

Proposed resolution

A checkbox "Disable for admin theme" in Toastify settings would be great. Not sure how that could be implemented to work with the class swap.

Issue fork toastify-3387703

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

John Pitcairn created an issue. See original summary.

keshavv’s picture

Status: Active » Needs review
StatusFileSize
new3.03 KB

Created a patch as per the request, Please review.

dieterholvoet’s picture

Status: Needs review » Needs work

I think it would be better/more flexible to create a setting named 'Enable for' with two checkboxes, 'Admin theme' and 'Frontend theme'. This way the module can also be used only in the admin theme. The two checkboxes should be enabled by default for both new and existing installations, to preserve backwards compatibility.

johnpitcairn’s picture

Or even add a checkbox to each individual theme's settings. Maybe that's a followup ;-)

dieterholvoet’s picture

Title: Disable for admin theme? » Add the option to disable for admin routes

sourabhsisodia_ made their first commit to this issue’s fork.

sourabhsisodia_’s picture

Assigned: Unassigned » sourabhsisodia_

sourabhsisodia_’s picture

Assigned: sourabhsisodia_ » Unassigned
Status: Needs work » Needs review
tirupati_singh’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new57.03 KB
new147.12 KB
new75.95 KB

Hi, I've applied the provided MR as a patch and it applied cleanly without any errors. After applying the patch, a new configuration field 'Enable for' has been provided to Enable/Disable the module functionality for the Admin Theme or Frontend Theme. When the Admin Theme option is unchecked then the messaging shown is unaltered. The provided new field functionality is working fine. I'm attaching the screenshots of the before and after fixes for reference and moving the issue to RTBC.

Thanks!

  • dieterholvoet committed c379fd50 on 8.x-1.x
    Merge branch '3387703-add-the-option' into '8.x-1.x'
    
    Issue #3387703:...

dieterholvoet’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.