Wordpress 4.6
[autoinstalls/wordpress.git] / wp-includes / widgets / class-wp-nav-menu-widget.php
index d465525913749874455b689278b28fd34853ca53..336845845716c37a3cd9cdd32ecf18deaae56a40 100644 (file)
@@ -14,7 +14,7 @@
  *
  * @see WP_Widget
  */
- class WP_Nav_Menu_Widget extends WP_Widget {
+class WP_Nav_Menu_Widget extends WP_Widget {
 
        /**
         * Sets up a new Custom Menu widget instance.
@@ -61,7 +61,7 @@
                );
 
                /**
-                * Filter the arguments for the Custom Menu widget.
+                * Filters the arguments for the Custom Menu widget.
                 *
                 * @since 4.2.0
                 * @since 4.4.0 Added the `$instance` parameter.
         * @access public
         *
         * @param array $instance Current settings.
+        * @global WP_Customize_Manager $wp_customize
         */
        public function form( $instance ) {
+               global $wp_customize;
                $title = isset( $instance['title'] ) ? $instance['title'] : '';
                $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
 
                ?>
                <p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>>
                        <?php
-                       if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) {
+                       if ( $wp_customize instanceof WP_Customize_Manager ) {
                                $url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
                        } else {
                                $url = admin_url( 'nav-menus.php' );
                                        <?php endforeach; ?>
                                </select>
                        </p>
+                       <?php if ( $wp_customize instanceof WP_Customize_Manager ) : ?>
+                               <p class="edit-selected-nav-menu" style="<?php if ( ! $nav_menu ) { echo 'display: none;'; } ?>">
+                                       <button type="button" class="button"><?php _e( 'Edit Menu' ) ?></button>
+                               </p>
+                       <?php endif; ?>
                </div>
                <?php
        }