[wp-trac] [WordPress Trac] #37980: Don't attach events to customizer section headings with cannot-expand class

WordPress Trac noreply at wordpress.org
Sun Sep 18 18:40:09 UTC 2016


#37980: Don't attach events to customizer section headings with cannot-expand class
---------------------------------------------+-------------------------
 Reporter:  celloexpressions                 |       Owner:
     Type:  defect (bug)                     |      Status:  new
 Priority:  normal                           |   Milestone:  4.7
Component:  Customize                        |     Version:  4.3
 Severity:  normal                           |  Resolution:
 Keywords:  good-first-bug has-patch commit  |     Focuses:  javascript
---------------------------------------------+-------------------------
Changes (by celloexpressions):

 * keywords:  needs-patch good-first-bug => good-first-bug has-patch commit


Comment:

 Thanks for the patch @kkoppenhaver! This looks good. The only issue I saw
 is that there needs to be a space between the `if` and the `(` per the
 [https://make.wordpress.org/core/handbook/best-practices/coding-
 standards/php/#space-usage coding standards].

 I noticed that the CSS side of `cannot-expand` doesn't seem to work
 anymore, so I added that to the patch and it should be ready for commit
 now. Here's some code I tested with (in a customize register callback):

 {{{
 class Fifteen_Customize_Example_Section extends WP_Customize_Section {
         public $type = 'test';

         public function render_template() { ?>
                 <li id="accordion-section-{{ data.id }}" class="accordion-
 section control-section control-section-{{ data.type }} cannot-expand">
                         <h3 class="accordion-section-title">
                                 {{ data.title }}
                         </h3>
                         <p>Some other text.</p>
                 </li>
         <?php
         }
 }

 $wp_customize->add_section( new Fifteen_Customize_Example_Section(
 $wp_customize, 'test', array( 'title' => 'Test' ) ) );
 $wp_customize->add_setting( 'test', array() );
 $wp_customize->add_control( 'test', array( 'type' => 'text', 'section' =>
 'test' ) );
 $wp_customize->register_section_type( 'Fifteen_Customize_Example_Section'
 );
 }}}

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


More information about the wp-trac mailing list