Button style, conflicts with RootCandy theme, mainly because it allready uses sliding door technique. Shows original RootCandy style on the left side of button and 'Button Style' on the right side, and no text - probably due to the 1em problem explained below.

I also noticed that buttons that use em fontsize, shows as buttons with no text.

/Philip

Comments

Jackinloadup’s picture

It would be really nice if there was a way to turn off the module for particular themes. This also conflicts with the slate theme in the admin module.

robloach’s picture

Title: Conflicts with RootCandy Theme and other styles using em » Button Style on a per-theme basis
Version: 6.x-1.0 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new3.6 KB

Ran into the RootCandy problem so this patch makes it so that you can enable/disable the button style on a per-theme basis. You change the setting in the theme settings pages.

ghazlewood’s picture

Rob thanks for the patch, much appreciated. Was exactly what I was thinking as soon as I saw the problem with this module and RootCandy. Hope the patch is committed soon :)

Roulion’s picture

The patch is OK.. thanks a lot

sun’s picture

+++ button_style.module	22 Sep 2009 13:58:27 -0000
@@ -10,26 +10,48 @@
+  if ($form_id == 'system_theme_settings' && $form['var']['#value'] != 'theme_settings') {

We want to use hook_form_FORM_alter() here, no?

+++ button_style.module	22 Sep 2009 13:58:27 -0000
@@ -10,26 +10,48 @@
+  if (variable_get('button_style_theme_'. $theme_key .'_settings', TRUE)) {

Can we negate the condition and thereby reduce the size of this patch?

I'm on crack. Are you, too?

tanc’s picture

Thanks Rob, just wanted to confirm the patch in #2 seems to work well for me.

detot’s picture

Works for me too!

robloach’s picture

Status: Needs review » Needs work

Sun's suggestions are good suggestions!

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new2.18 KB

I've reverted my opinion on the default status. Let's enable it by default, so users actually see something after installing ;)

- Fixed variable name mismatches.

- Added hook_form_FORMID_alter() implementation.

- Changed hook_form_alter() to early-return to decrease code changes and make the flow more obvious.

- Fixed docs.

- Removed cache_clear_all() from hook_uninstall(), should be invoked anyway, and even if it's not, the cache doesn't matter as it'll be rebuilt at some point anyway.

However, untested.

Q: Do we really need our own submit handler to store the variable? I thought there was some kind of theme settings API or whatever? :( Does core suck again? ;)

sun’s picture

Category: bug » feature

err, bug report? :P

itangalo’s picture

Status: Needs work » Needs review

When testing this patch (#9) on the Seven admin theme, it just didn't seem to kick in. Broken buttons with no text, button.css loaded and everything. Sorry for the bad news. :-/

Seven 6.x-1.0-beta6
Pressflow 6.16

itangalo’s picture

Status: Needs review » Needs work
dixon_’s picture

Status: Needs review » Needs work
StatusFileSize
new2.25 KB
+++ button_style.module	3 Mar 2010 15:26:06 -0000
@@ -7,9 +7,39 @@
+      '#type' => 'checkbox',
+      '#title' => t('Button style'),
+      '#default_value' => variable_get('button_style_theme_' . $form['var']['#value'], TRUE),

The 'var' key will contain something like 'theme_THEME_KEY_settings'. So this variable is named incorrectly.

+++ button_style.module	3 Mar 2010 15:26:06 -0000
@@ -7,9 +7,39 @@
+  variable_set('button_style_theme_' . $form_state['values']['var'], $form_state['values']['button_style']);

The same goes for this.

+++ button_style.module	3 Mar 2010 15:26:06 -0000
@@ -7,9 +7,39 @@
+  init_theme();
+  global $theme_key;
+  if (!variable_get('button_style_theme_' . $theme_key, TRUE)) {
+    return;
+  }

Here we must suffix with '_settings' to look for the right variable.

Attached is a patch that fixes all this. It applies to DRUPAL-6--1.

Powered by Dreditor.

dixon_’s picture

Status: Needs work » Needs review
itangalo’s picture

Implemented and seems to work fine on Pressflow 6.16 (plus Seven 6.x-1.0-beta6)!

nod_’s picture

Status: Needs review » Reviewed & tested by the community

works fine for me too.

boobaa’s picture

Status: Reviewed & tested by the community » Needs work

(At least a part of) the cache should be invalidated after a DELETE FROM {variables} in hook_uninstall(): cache_clear_all('variables', 'cache'); should be run, @see variable_del().

skilip’s picture

For Drupal 7 there's a patch over here: #1023564: Button Style on a per-theme basis D7