home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress2 / wp-includes / customize / class-wp-customize-nav-menu-section.php < prev    next >
Encoding:
PHP Script  |  2017-07-26  |  709 b   |  42 lines

  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. /**
  11.  * Customize Menu Section Class
  12.  *
  13.  * Custom section only needed in JS.
  14.  *
  15.  * @since 4.3.0
  16.  *
  17.  * @see WP_Customize_Section
  18.  */
  19. class WP_Customize_Nav_Menu_Section extends WP_Customize_Section {
  20.  
  21.     /**
  22.      * Control type.
  23.      *
  24.      * @since 4.3.0
  25.      * @var string
  26.      */
  27.     public $type = 'nav_menu';
  28.  
  29.     /**
  30.      * Get section parameters for JS.
  31.      *
  32.      * @since 4.3.0
  33.      * @return array Exported parameters.
  34.      */
  35.     public function json() {
  36.         $exported = parent::json();
  37.         $exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ) );
  38.  
  39.         return $exported;
  40.     }
  41. }
  42.