class-wp-customize-nav-menu-section.php 716 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Customize API: WP_Customize_Nav_Menu_Section class
  4. *
  5. * @package WordPress
  6. * @subpackage Customize
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Customize Menu Section Class
  11. *
  12. * Custom section only needed in JS.
  13. *
  14. * @since 4.3.0
  15. *
  16. * @see WP_Customize_Section
  17. */
  18. class WP_Customize_Nav_Menu_Section extends WP_Customize_Section {
  19. /**
  20. * Control type.
  21. *
  22. * @since 4.3.0
  23. * @var string
  24. */
  25. public $type = 'nav_menu';
  26. /**
  27. * Get section parameters for JS.
  28. *
  29. * @since 4.3.0
  30. * @return array Exported parameters.
  31. */
  32. public function json() {
  33. $exported = parent::json();
  34. $exported['menu_id'] = (int) preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id );
  35. return $exported;
  36. }
  37. }