class-wp-customize-sidebar-section.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Sidebar_Section class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Customizer section representing widget area (sidebar).
  11. *
  12. * @since 4.1.0
  13. *
  14. * @see WP_Customize_Section
  15. */
  16. class WP_Customize_Sidebar_Section extends WP_Customize_Section {
  17. /**
  18. * Type of this section.
  19. *
  20. * @since 4.1.0
  21. * @var string
  22. */
  23. public $type = 'sidebar';
  24. /**
  25. * Unique identifier.
  26. *
  27. * @since 4.1.0
  28. * @var string
  29. */
  30. public $sidebar_id;
  31. /**
  32. * Gather the parameters passed to client JavaScript via JSON.
  33. *
  34. * @since 4.1.0
  35. *
  36. * @return array The array to be exported to the client as JSON.
  37. */
  38. public function json() {
  39. $json = parent::json();
  40. $json['sidebarId'] = $this->sidebar_id;
  41. return $json;
  42. }
  43. /**
  44. * Whether the current sidebar is rendered on the page.
  45. *
  46. * @since 4.1.0
  47. *
  48. * @return bool Whether sidebar is rendered.
  49. */
  50. public function active_callback() {
  51. return $this->manager->widgets->is_sidebar_rendered( $this->sidebar_id );
  52. }
  53. }