Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#12207 closed defect (bug) (invalid)

Trying to override wordpress_adv_hidden to show "kitchen sink" has no effect

Reported by: amattie's profile amattie Owned by: azaozz's profile azaozz
Milestone: Priority: normal
Severity: normal Version: 2.9.1
Component: TinyMCE Keywords:
Focuses: Cc:

Description

There's a setting that WordPress / TinyMCE consumes called wordpress_adv_hidden, but it doesn't appear that one can override this setting using the teeny_mce_before_init and tiny_mce_before_init filters. It is certainly possible to add wordpress_adv_hidden => 0 (or "0", doesn't matter) to this array via the filter, but when the TinyMCE settings ultimately get written out in the JavaScript, the values in the key / value pair are always quoted.

Ultimately, these quoted values are causing an issue due to the irritating way JavaScript handles boolean assertions ("0" && {} is true, 0 && {} is false, yet 0 == "0" is true). In the case of this issue, since the values are quoted, the assertion is evaluating to true even if I try to set the value to false so that the "kitchen sink" will forcibly show.

Since wordpress_adv_hidden is set in the JavaScript as a number anyway, can we just wrap a parseInt around that assertion? See patch.

Attachments (1)

toggle_wordpress_adv_hidden.patch (693 bytes) - added by amattie 15 years ago.
Wrap parseInt around wordpress_adv_hidden check

Download all attachments as: .zip

Change History (5)

@amattie
15 years ago

Wrap parseInt around wordpress_adv_hidden check

#1 @nacin
15 years ago

  • Milestone changed from 2.9.3 to 3.0

#2 @azaozz
15 years ago

Have you tried passing an empty string there, i.e. wordpress_adv_hidden => "". That should always evaluate to false.

#3 @nacin
15 years ago

  • Keywords reporter-feedback close added
  • Milestone changed from 3.0 to Unassigned

#4 @johnbillion
15 years ago

  • Keywords reporter-feedback close removed
  • Milestone Unassigned deleted
  • Resolution set to invalid
  • Status changed from new to closed

You should use boolean false instead of 0. This works as expected:

function unhide_kitchensink( $args ) {
	$args['wordpress_adv_hidden'] = false;
	return $args;
}
add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' );

Note: See TracTickets for help on using tickets.