[wp-trac] [WordPress Trac] #42753: possible bug in filter wp_code_editor_setting

WordPress Trac noreply at wordpress.org
Wed Jan 17 22:17:22 UTC 2018


#42753: possible bug in filter wp_code_editor_setting
--------------------------+------------------------------
 Reporter:  willrad       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  TinyMCE       |     Version:  4.9
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by willrad):

 * component:  Editor => TinyMCE


Comment:

 Using $args instead produces the right results from the filter. The class
 gets renamed and styling is overridden with linting\hinting intact.


 {{{#!php
 <?php
 // filter used with $args
 add_filter( 'wp_code_editor_settings', function( $args ) {

 // send an empty array with it??
 if (!is_array($settings))$settings = array($settings);

 $new_args =
 $args['codemirror']['theme'] = 'one-dark';
 return array_merge($settings,$args);
 });

 // register stylesheet
 wp_register_style('one-dark', plugin_dir_url( __FILE__ ) . 'one-dark.css',
 array(), '1');

 // enqueue stylesheet
 wp_enqueue_style('one-dark');
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42753#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list