[wp-trac] [WordPress Trac] #15596: Allow JS functions in TinyMCE $initArray
WordPress Trac
wp-trac at lists.automattic.com
Sun Nov 28 12:29:18 UTC 2010
#15596: Allow JS functions in TinyMCE $initArray
-------------------------+--------------------------------------------------
Reporter: janfabry | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: 3.1
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
Comment(by Denis-de-Bernardy):
This would be sooo neat.
Ran into the issue myself, and I had to do weird a workaround to get
multi-dimensional objects in there, aka:
{{{
// ...
$campaign = array(
'publish' => __('Launch', 'sem-backend'),
'publishNow' => __('Launch:', 'sem-backend'),
'publishOn' => __('Launch on:', 'sem-backend'),
'publishOnPast' => __('Launched on:', 'sem-
backend'),
'unit' => __('Coupon left', 'sem-backend'),
'units' => __('Coupons left', 'sem-backend'),
);
$extra_captions = compact('defaults', 'product',
'campaign');
$extra_captions = apply_filters('sem_backend_localize_js',
$extra_captions);
foreach ( $extra_captions as $key => $extra ) {
$data = "\n\nsem_backendL10n['$key'] = {\n";
$eol = '';
foreach ( $extra as $var => $val ) {
$data .= "$eol\t$var: \"" . esc_js($val) .
'"';
$eol = ",\n";
}
$data .= "\n};\n";
$data .=
"try{convertEntities(sem_backendL10n.$key);}catch(e){};\n";
$captions['l10n_print_after'] .= $data;
}
wp_localize_script('sb-data-admin', 'sem_backendL10n',
$captions);
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15596#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list