You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
1.8 KiB

  1. <?php
  2. /**
  3. * Customize API: WP_Widget_Area_Customize_Control class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 3.4.0
  8. */
  9. /**
  10. * Widget Area Customize Control class.
  11. *
  12. * @since 3.9.0
  13. *
  14. * @see WP_Customize_Control
  15. */
  16. class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
  17. /**
  18. * Customize control type.
  19. *
  20. * @since 3.9.0
  21. * @access public
  22. * @var string
  23. */
  24. public $type = 'sidebar_widgets';
  25. /**
  26. * Sidebar ID.
  27. *
  28. * @since 3.9.0
  29. * @access public
  30. * @var int|string
  31. */
  32. public $sidebar_id;
  33. /**
  34. * Refreshes the parameters passed to the JavaScript via JSON.
  35. *
  36. * @since 3.9.0
  37. * @access public
  38. */
  39. public function to_json() {
  40. parent::to_json();
  41. $exported_properties = array( 'sidebar_id' );
  42. foreach ( $exported_properties as $key ) {
  43. $this->json[ $key ] = $this->$key;
  44. }
  45. }
  46. /**
  47. * Renders the control's content.
  48. *
  49. * @since 3.9.0
  50. * @access public
  51. */
  52. public function render_content() {
  53. $id = 'reorder-widgets-desc-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
  54. ?>
  55. <button type="button" class="button add-new-widget" aria-expanded="false" aria-controls="available-widgets">
  56. <?php _e( 'Add a Widget' ); ?>
  57. </button>
  58. <button type="button" class="button-link reorder-toggle" aria-label="<?php esc_attr_e( 'Reorder widgets' ); ?>" aria-describedby="<?php echo esc_attr( $id ); ?>">
  59. <span class="reorder"><?php _ex( 'Reorder', 'Reorder widgets in Customizer' ); ?></span>
  60. <span class="reorder-done"><?php _ex( 'Done', 'Cancel reordering widgets in Customizer' ); ?></span>
  61. </button>
  62. <p class="screen-reader-text" id="<?php echo esc_attr( $id ); ?>"><?php _e( 'When in reorder mode, additional controls to reorder widgets will be available in the widgets list above.' ); ?></p>
  63. <?php
  64. }
  65. }