Changeset 20506
- Timestamp:
- 04/18/2012 05:13:31 PM (13 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-customize-control.php
r20504 r20506 23 23 public $json = array(); 24 24 25 public $visibility;26 27 25 public $type = 'text'; 28 26 … … 103 101 104 102 $this->json['type'] = $this->type; 105 106 if ( $this->visibility ) {107 if ( is_string( $this->visibility ) ) {108 $this->json['visibility'] = array(109 'id' => $this->visibility,110 'value' => true,111 );112 } else {113 $this->json['visibility'] = array(114 'id' => $this->visibility[0],115 'value' => $this->visibility[1],116 );117 }118 119 }120 103 } 121 104 … … 164 147 $class = 'customize-control customize-control-' . $this->type; 165 148 166 $style = ''; 167 if ( $this->visibility ) { 168 if ( is_string( $this->visibility ) ) { 169 $visibility_id = $this->visibility; 170 $visibility_value = true; 171 } else { 172 $visibility_id = $this->visibility[0]; 173 $visibility_value = $this->visibility[1]; 174 } 175 $visibility_setting = $this->manager->get_setting( $visibility_id ); 176 177 if ( $visibility_setting && $visibility_value != $visibility_setting->value() ) 178 $style = 'style="display:none;"'; 179 } 180 181 ?><li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>" <?php echo $style; ?>> 149 ?><li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>"> 182 150 <?php $this->render_content(); ?> 183 151 </li><?php -
trunk/wp-includes/class-wp-customize.php
r20496 r20506 592 592 'label' => __( 'Background Repeat' ), 593 593 'section' => 'background', 594 'visibility' => 'background_image',595 594 'type' => 'radio', 596 595 'choices' => array( … … 610 609 'label' => __( 'Background Position' ), 611 610 'section' => 'background', 612 'visibility' => 'background_image',613 611 'type' => 'radio', 614 612 'choices' => array( … … 627 625 'label' => __( 'Background Attachment' ), 628 626 'section' => 'background', 629 'visibility' => 'background_image',630 627 'type' => 'radio', 631 628 'choices' => array( … … 709 706 'section' => 'static_front_page', 710 707 'type' => 'dropdown-pages', 711 'visibility' => array( 'show_on_front', 'page' ),712 708 ) ); 713 709 … … 722 718 'section' => 'static_front_page', 723 719 'type' => 'dropdown-pages', 724 'visibility' => array( 'show_on_front', 'page' ),725 720 ) ); 726 721 -
trunk/wp-includes/js/customize-controls.dev.js
r20504 r20506 378 378 previewer: previewer 379 379 } ) ); 380 381 if ( data.visibility ) {382 api( data.visibility.id, function( other ) {383 if ( 'boolean' === typeof data.visibility.value ) {384 other.bind( function( to ) {385 control.container.toggle( !! to == data.visibility.value );386 });387 } else {388 other.bind( function( to ) {389 control.container.toggle( to == data.visibility.value );390 });391 }392 });393 }394 380 }); 395 381 … … 416 402 }); 417 403 404 // Control visibility for default controls 405 $.each({ 406 'background_image': { 407 controls: [ 'background_repeat', 'background_position_x', 'background_attachment' ], 408 callback: function( to ) { return !! to } 409 }, 410 'show_on_front': { 411 controls: [ 'page_on_front', 'page_for_posts' ], 412 callback: function( to ) { return 'page' === to } 413 }, 414 'header_textcolor': { 415 controls: [ 'header_textcolor' ], 416 callback: function( to ) { return 'blank' !== to } 417 } 418 }, function( settingId, o ) { 419 api( settingId, function( setting ) { 420 $.each( o.controls, function( i, controlId ) { 421 api.control( controlId, function( control ) { 422 var visibility = function( to ) { 423 control.container.toggle( o.callback( to ) ); 424 }; 425 426 visibility( setting.get() ); 427 setting.bind( visibility ); 428 }); 429 }); 430 }); 431 }); 432 433 // Juggle the two controls that use header_textcolor 418 434 api.control( 'display_header_text', function( control ) { 419 435 var last = '';
Note: See TracChangeset
for help on using the changeset viewer.