Problem/Motivation

When disabling the default Chosen theme (CSS), Chosen is broken for themes that don't have custom Chosen styling.

Example use case:
You created custom chosen styling for your own front-end theme and therefore disabled the default Chosen CSS.
If the admin theme is different than your front-end theme, and you still want to use Chosen in the back-end, without making changes to that theme, it is not possible to use Chosen in the back-end since the styling is broken.

Proposed resolution

  1. Make the 'Use the default chosen theme' a per theme setting.
  2. And flip the CSS inclusion logic. Select the themes you want to exclude instead of deselecting the checkbox.

Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dmsmidt’s picture

Fix .install and some typ0's.

dmsmidt’s picture

cthos’s picture

This looks good to me, and is a great idea if you want to only have to override the settings on say the frontend, but not the admin theme.

OwilliwO’s picture

Hi !! Great idea.

It works for me.
Drupal 7.37
Chosen 7.x-2.0-beta4

I can now use default CSS for my admin theme (adminimal) and let a front-end developer fully customize it in front theme.

Thanks!!

manumilou’s picture

+1 - Very useful, thx

dmsmidt’s picture

If you reviewed the code and this works for you please set the status to RTBC :-)

OwilliwO’s picture

Status: Needs review » Reviewed & tested by the community

Simple, but great patch !

marcoka’s picture

great patch. much appreciated. works and is exacly what you need if you want a custom chosen theme.

nagy.balint’s picture

Status: Reviewed & tested by the community » Needs work

The patch is great, but unfortunately the update hook does not work properly for me.

If the chosen css is disabled, it is supposed to check all the checkboxes, but for me it just does not happen.

array_keys(_chosen_enabled_themes_options()) produces an empty array in the update hook. Tried setting refresh to TRUE inside it, but did not work. In fact list themes function returns all themes with the status 0 so it will filter out all themes.
The code works fine if I run it separately in devel php, it only fails to provide proper statuses in the update hook (in both update.php and drush updb.)

Let me know if I missed something.

mr.york’s picture

mr.york’s picture

mr.york’s picture

Hide system theme in the list.

nagy.balint’s picture

Since in Drupal 8 this setting did not work before, and there is no stable release yet, the patch can be committed there without an update hook.

Committed.

Leaving it needs work for the D7 version from Comment #1, which does need a working update hook, otherwise could be committed.

  • nagy.balint committed 61a5a40 on 8.x-2.x authored by mr.york
    Issue #2410783 by mr.york, nagy.balint: Make the 'Use the default chosen...
mr.york’s picture

mr.york’s picture

Status: Needs work » Needs review

The last submitted patch, 10: drupal8-make_the_use_the-2410783-10.patch, failed testing.

The last submitted patch, 11: drupal8-make_the_use_the-2410783-11.patch, failed testing.

The last submitted patch, 12: drupal8-make_the_use_the-2410783-12.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 15: chosen-disable-css-per-theme-2410783-15.patch, failed testing.

dmsmidt’s picture

@nagy.balint Great that this has been committed to D8! (Some credits for my idea and work on the D7 version would have been appreciated for this commit, though..)

  • nagy.balint committed cddbcff on 7.x-2.x authored by dmsmidt
    Issue #2410783 by mr.york, dmsmidt: Make the 'Use the default chosen...
nagy.balint’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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