Ticket #18584: 18584.2.diff
File 18584.2.diff, 13.5 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/class-walker-nav-menu-edit.php
diff --git src/wp-admin/includes/class-walker-nav-menu-edit.php src/wp-admin/includes/class-walker-nav-menu-edit.php index b54f512..78a930d 100644
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { 151 151 </div> 152 152 153 153 <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?>"> 154 <?php if ( 'custom' == $item->type ) : ?> 154 <?php $nav_menu_item_fields = array(); ?> 155 <?php if ( 'custom' === $item->type ) : ?> 156 <?php ob_start(); ?> 155 157 <p class="field-url description description-wide"> 156 158 <label for="edit-menu-item-url-<?php echo $item_id; ?>"> 157 159 <?php _e( 'URL' ); ?><br /> 158 160 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" /> 159 161 </label> 160 162 </p> 163 <?php $nav_menu_item_fields['custom'] = ob_get_clean(); ?> 161 164 <?php endif; ?> 165 <?php ob_start(); ?> 162 166 <p class="description description-wide"> 163 167 <label for="edit-menu-item-title-<?php echo $item_id; ?>"> 164 168 <?php _e( 'Navigation Label' ); ?><br /> 165 169 <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" /> 166 170 </label> 167 171 </p> 172 <?php $nav_menu_item_fields['title'] = ob_get_clean(); ?> 173 <?php ob_start(); ?> 168 174 <p class="field-title-attribute description description-wide"> 169 175 <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>"> 170 176 <?php _e( 'Title Attribute' ); ?><br /> 171 177 <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>" /> 172 178 </label> 173 179 </p> 180 <?php $nav_menu_item_fields['attr-title'] = ob_get_clean(); ?> 181 <?php ob_start(); ?> 174 182 <p class="field-link-target description"> 175 183 <label for="edit-menu-item-target-<?php echo $item_id; ?>"> 176 184 <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $item->target, '_blank' ); ?> /> 177 185 <?php _e( 'Open link in a new tab' ); ?> 178 186 </label> 179 187 </p> 188 <?php $nav_menu_item_fields['link-target'] = ob_get_clean(); ?> 189 <?php ob_start(); ?> 180 190 <p class="field-css-classes description description-thin"> 181 191 <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> 182 192 <?php _e( 'CSS Classes (optional)' ); ?><br /> 183 193 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" /> 184 194 </label> 185 195 </p> 196 <?php $nav_menu_item_fields['css-classes'] = ob_get_clean(); ?> 197 <?php ob_start(); ?> 186 198 <p class="field-xfn description description-thin"> 187 199 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> 188 200 <?php _e( 'Link Relationship (XFN)' ); ?><br /> 189 201 <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" /> 190 202 </label> 191 203 </p> 204 <?php $nav_menu_item_fields['xfn'] = ob_get_clean(); ?> 205 <?php ob_start(); ?> 192 206 <p class="field-description description description-wide"> 193 207 <label for="edit-menu-item-description-<?php echo $item_id; ?>"> 194 208 <?php _e( 'Description' ); ?><br /> … … class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { 196 210 <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span> 197 211 </label> 198 212 </p> 213 <?php $nav_menu_item_fields['description'] = ob_get_clean(); ?> 214 215 <?php 216 /** 217 * Filter the nav menu fields to edit. 218 * 219 * This filter applies on the nav menus admin page for a specific nav menu item. 220 * 221 * @since 4.5.0 222 * 223 * @param array $nav_menu_item_fields Mapping of ID to the field paragraph HTML. 224 * @param array $context { 225 * Context for applied filter. 226 * 227 * @type Walker_Nav_Menu_Edit $walker Nav menu walker. 228 * @type object $item Menu item data object. 229 * @type int $depth Current depth. 230 * } 231 */ 232 $walker = $this; 233 $nav_menu_item_fields = apply_filters( 'wp_nav_menu_item_fields', $nav_menu_item_fields, compact( 'item', 'depth', 'walker' ) ); 234 235 echo join( "\n", array_values( $nav_menu_item_fields ) ); 236 ?> 199 237 200 238 <p class="field-move hide-if-no-js description description-wide"> 201 239 <label> -
src/wp-admin/includes/nav-menu.php
diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php index cb94fe2..f4029c4 100644
function wp_get_nav_menu_to_edit( $menu_id = 0 ) { 937 937 * 938 938 * @since 3.0.0 939 939 * 940 * @return string|WP_Error $output The menu formatted to edit or error object on failure.940 * @return array Columns. 941 941 */ 942 942 function wp_nav_menu_manage_columns() { 943 return array( 944 '_title' => __('Show advanced menu properties'), 945 'cb' => '<input type="checkbox" />', 946 'title-attribute' => __('Title Attribute'), 947 'link-target' => __('Link Target'), 948 'css-classes' => __('CSS Classes'), 949 'xfn' => __('Link Relationship (XFN)'), 950 'description' => __('Description'), 943 $columns = array( 944 'link-target' => __( 'Link Target' ), 945 'attr-title' => __( 'Title Attribute' ), 946 'css-classes' => __( 'CSS Classes' ), 947 'xfn' => __( 'Link Relationship (XFN)' ), 948 'description' => __( 'Description' ), 949 ); 950 951 /** 952 * Filter columns which can be toggled on the nav menu page. 953 */ 954 $columns = apply_filters( 'wp_nav_menu_manage_columns', $columns ); 955 956 return array_merge( 957 array( 958 '_title' => __( 'Show advanced menu properties' ), 959 'cb' => '<input type="checkbox" />', 960 ), 961 $columns 951 962 ); 952 963 } 953 964 -
src/wp-admin/js/customize-nav-menus.js
diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js index bcebb65..bfe3144 100644
216 216 .prop( 'tabIndex', -1 ) 217 217 .removeClass( 'is-visible' ); 218 218 } 219 219 220 220 this.searchTerm = event.target.value; 221 221 this.pages.search = 1; 222 222 this.doSearch( 1 ); … … 631 631 }, 632 632 633 633 hidden: function() { 634 this.hidden = function() { 635 return $( '.hide-column-tog' ).not( ':checked' ).map( function() { 636 var id = this.id; 637 return id.substring( id, id.length - 5 ); 638 }).get().join( ',' ); 639 }; 634 return $( '.hide-column-tog' ).not( ':checked' ).map( function() { 635 var id = this.id; 636 return id.substring( 0, id.length - 5 ); 637 }).get().join( ',' ); 640 638 } 641 639 } ); 642 640 -
src/wp-includes/customize/class-wp-customize-nav-menu-item-control.php
diff --git src/wp-includes/customize/class-wp-customize-nav-menu-item-control.php src/wp-includes/customize/class-wp-customize-nav-menu-item-control.php index 466f214..1bf39fc 100644
class WP_Customize_Nav_Menu_Item_Control extends WP_Customize_Control { 85 85 </div> 86 86 87 87 <div class="menu-item-settings" id="menu-item-settings-{{ data.menu_item_id }}"> 88 <?php $nav_menu_item_fields = array(); ?> 89 <?php ob_start(); ?> 88 90 <# if ( 'custom' === data.item_type ) { #> 89 <p class="field-url description description-thin"> 90 <label for="edit-menu-item-url-{{ data.menu_item_id }}"> 91 <?php _e( 'URL' ); ?><br /> 92 <input class="widefat code edit-menu-item-url" type="text" id="edit-menu-item-url-{{ data.menu_item_id }}" name="menu-item-url" /> 93 </label> 94 </p> 95 <# } #> 91 <p class="field-url description description-thin"> 92 <label for="edit-menu-item-url-{{ data.menu_item_id }}"> 93 <?php _e( 'URL' ); ?><br /> 94 <input class="widefat code edit-menu-item-url" type="text" id="edit-menu-item-url-{{ data.menu_item_id }}" name="menu-item-url" /> 95 </label> 96 </p> 97 <# } #> 98 <?php $nav_menu_item_fields['custom'] = ob_get_clean(); ?> 99 <?php ob_start(); ?> 96 100 <p class="description description-thin"> 97 101 <label for="edit-menu-item-title-{{ data.menu_item_id }}"> 98 102 <?php _e( 'Navigation Label' ); ?><br /> 99 103 <input type="text" id="edit-menu-item-title-{{ data.menu_item_id }}" class="widefat edit-menu-item-title" name="menu-item-title" /> 100 104 </label> 101 105 </p> 106 <?php $nav_menu_item_fields['title'] = ob_get_clean(); ?> 107 <?php ob_start(); ?> 102 108 <p class="field-link-target description description-thin"> 103 109 <label for="edit-menu-item-target-{{ data.menu_item_id }}"> 104 110 <input type="checkbox" id="edit-menu-item-target-{{ data.menu_item_id }}" class="edit-menu-item-target" value="_blank" name="menu-item-target" /> 105 111 <?php _e( 'Open link in a new tab' ); ?> 106 112 </label> 107 113 </p> 114 <?php $nav_menu_item_fields['link-target'] = ob_get_clean(); ?> 115 <?php ob_start(); ?> 108 116 <p class="field-attr-title description description-thin"> 109 117 <label for="edit-menu-item-attr-title-{{ data.menu_item_id }}"> 110 118 <?php _e( 'Title Attribute' ); ?><br /> 111 119 <input type="text" id="edit-menu-item-attr-title-{{ data.menu_item_id }}" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title" /> 112 120 </label> 113 121 </p> 122 <?php $nav_menu_item_fields['attr-title'] = ob_get_clean(); ?> 123 <?php ob_start(); ?> 114 124 <p class="field-css-classes description description-thin"> 115 125 <label for="edit-menu-item-classes-{{ data.menu_item_id }}"> 116 126 <?php _e( 'CSS Classes' ); ?><br /> 117 127 <input type="text" id="edit-menu-item-classes-{{ data.menu_item_id }}" class="widefat code edit-menu-item-classes" name="menu-item-classes" /> 118 128 </label> 119 129 </p> 130 <?php $nav_menu_item_fields['css-classes'] = ob_get_clean(); ?> 131 <?php ob_start(); ?> 120 132 <p class="field-xfn description description-thin"> 121 133 <label for="edit-menu-item-xfn-{{ data.menu_item_id }}"> 122 134 <?php _e( 'Link Relationship (XFN)' ); ?><br /> 123 135 <input type="text" id="edit-menu-item-xfn-{{ data.menu_item_id }}" class="widefat code edit-menu-item-xfn" name="menu-item-xfn" /> 124 136 </label> 125 137 </p> 138 <?php $nav_menu_item_fields['xfn'] = ob_get_clean(); ?> 139 <?php ob_start(); ?> 126 140 <p class="field-description description description-thin"> 127 141 <label for="edit-menu-item-description-{{ data.menu_item_id }}"> 128 142 <?php _e( 'Description' ); ?><br /> … … class WP_Customize_Nav_Menu_Item_Control extends WP_Customize_Control { 130 144 <span class="description"><?php _e( 'The description will be displayed in the menu if the current theme supports it.' ); ?></span> 131 145 </label> 132 146 </p> 147 <?php $nav_menu_item_fields['description'] = ob_get_clean(); ?> 148 149 <?php 150 /** 151 * Filter the nav menu fields to edit. 152 * 153 * This filter applies on the nav menu item control template in the Customizer. 154 * 155 * @since 4.5.0 156 * 157 * @param array $nav_menu_item_fields Mapping of ID to the field paragraph HTML. 158 * @param array $context { 159 * Context for applied filter. 160 * 161 * @type WP_Customize_Nav_Menu_Item_Control $customize_control Customize control. 162 * } 163 */ 164 $nav_menu_item_fields = apply_filters( 'wp_nav_menu_item_fields', $nav_menu_item_fields, array( 'customize_control' => $this ) ); 165 166 echo join( "\n", array_values( $nav_menu_item_fields ) ); 167 ?> 133 168 134 169 <div class="menu-item-actions description-thin submitbox"> 135 170 <# if ( ( 'post_type' === data.item_type || 'taxonomy' === data.item_type ) && '' !== data.original_title ) { #> -
src/wp-includes/customize/class-wp-customize-nav-menus-panel.php
diff --git src/wp-includes/customize/class-wp-customize-nav-menus-panel.php src/wp-includes/customize/class-wp-customize-nav-menus-panel.php index e3be24b..094a766 100644
class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel { 34 34 * @access public 35 35 */ 36 36 public function render_screen_options() { 37 // Essentially adds the screen options. 38 add_filter( 'manage_nav-menus_columns', array( $this, 'wp_nav_menu_manage_columns' ) ); 37 // Adds the screen options. 38 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 39 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); 39 40 40 41 // Display screen options. 41 42 $screen = WP_Screen::get( 'nav-menus.php' ); … … class WP_Customize_Nav_Menus_Panel extends WP_Customize_Panel { 48 49 * Link title attribute added as it's a relatively advanced concept for new users. 49 50 * 50 51 * @since 4.3.0 51 * @access public 52 * 53 * @return array The advanced menu properties. 52 * @deprecated 4.5.0 Deprecated in favor of wp_nav_menu_manage_columns(). 54 53 */ 55 54 public function wp_nav_menu_manage_columns() { 56 return array( 57 '_title' => __( 'Show advanced menu properties' ), 58 'cb' => '<input type="checkbox" />', 59 'link-target' => __( 'Link Target' ), 60 'attr-title' => __( 'Title Attribute' ), 61 'css-classes' => __( 'CSS Classes' ), 62 'xfn' => __( 'Link Relationship (XFN)' ), 63 'description' => __( 'Description' ), 64 ); 55 _deprecated_function( __METHOD__, '4.5.0', 'wp_nav_menu_manage_columns' ); 56 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 57 return wp_nav_menu_manage_columns(); 65 58 } 66 59 67 60 /**