Make WordPress Core


Ignore:
Timestamp:
07/13/2015 08:39:17 AM (11 years ago)
Author:
westonruter
Message:

Customizer: Disambiguate a menu's auto-add pages option from preceding menu location checkboxes.

Creates a separate nav_menu_auto_add control type following the pattern of the nav_menu_name control type.

Props valendesigns.
Fixes #32820.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-control.php

    r33164 r33189  
    16041604
    16051605                </ul>
    1606                 <?php endif; ?>
    1607                 <p>
    1608                         <label>
    1609                                 <input type="checkbox" class="auto_add">
    1610                                 <?php _e( 'Automatically add new top-level pages to this menu' ) ?>
    1611                         </label>
    1612                 </p>
    1613                 <?php
     1606                <?php endif;
    16141607        }
    16151608
     
    18871880
    18881881/**
     1882 * Customize control to represent the auto_add field for a given menu.
     1883 *
     1884 * @since 4.3.0
     1885 */
     1886class WP_Customize_Nav_Menu_Auto_Add_Control extends WP_Customize_Control {
     1887
     1888        /**
     1889         * Type of control, used by JS.
     1890         *
     1891         * @since 4.3.0
     1892         *
     1893         * @var string
     1894         */
     1895        public $type = 'nav_menu_auto_add';
     1896
     1897        /**
     1898         * No-op since we're using JS template.
     1899         *
     1900         * @since 4.3.0
     1901         */
     1902        protected function render_content() {}
     1903
     1904        /**
     1905         * Render the Underscore template for this control.
     1906         *
     1907         * @since 4.3.0
     1908         */
     1909        protected function content_template() {
     1910                ?>
     1911                <label>
     1912                        <span class="customize-control-title"><?php _e( 'Menu Options' ); ?></span>
     1913                        <input type="checkbox" class="auto_add" />
     1914                        <?php _e( 'Automatically add new top-level pages to this menu' ); ?>
     1915                </label>
     1916                <?php
     1917        }
     1918}
     1919
     1920/**
    18891921 * Customize control class for new menus.
    18901922 *
Note: See TracChangeset for help on using the changeset viewer.