Ticket #37513: 37513.3.patch
File 37513.3.patch, 4.1 KB (added by , 8 years ago) |
---|
-
wp-includes/class-wp-admin-bar.php
258 258 } 259 259 260 260 /** 261 * @param string|object $node The node ID or object 262 * @param array $tree An array of tree node ID's 263 * 264 * @return array 265 */ 266 final public function get_node_tree( $node, $tree = array() ) { 267 268 if ( ! is_object( $node ) && isset( $this->nodes[ $node ] ) ) { 269 $node = $this->nodes[ $node ]; 270 } 271 272 if ( isset( $node->parent ) && 'root' !== $node->parent ) { 273 array_unshift( $tree, $node->parent ); 274 $tree = $this->get_node_tree( $node->parent, $tree ); 275 } 276 277 return $tree; 278 } 279 280 /** 281 * @param string|object $node The node ID or object 282 * @param string $search The search item ID 283 * 284 * @return bool 285 */ 286 final public function is_tree( $node, $search ) { 287 $tree = $this->get_node_tree( $node ); 288 if ( in_array( $search, $tree ) ) { 289 return true; 290 } 291 return false; 292 } 293 294 /** 261 295 * @access public 262 296 */ 263 297 public function render() { … … 478 512 $has_link = ! empty( $node->href ); 479 513 $is_root_top_item = 'root-default' === $node->parent; 480 514 $is_top_secondary_item = 'top-secondary' === $node->parent; 515 $is_root_top_tree = $this->is_tree( $node, 'root-default' ); 516 $is_top_secondary_tree = $this->is_tree( $node, 'top-secondary' ); 481 517 482 518 // Allow only numeric values, then casted to integers, and allow a tabindex value of `0` for a11y. 483 519 $tabindex = ( isset( $node->meta['tabindex'] ) && is_numeric( $node->meta['tabindex'] ) ) ? (int) $node->meta['tabindex'] : ''; 484 520 $aria_attributes = ( '' !== $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; 485 521 486 $menuclass = $arrow _right= '';522 $menuclass = $arrow = ''; 487 523 488 524 if ( $is_parent ) { 489 525 $menuclass = 'menupop '; … … 491 527 } 492 528 493 529 // Print the right arrow icon for the primary menu children with children. 494 if ( ! $is_root_top_item && ! $is_top_secondary_item && $is_parent ) {495 $arrow _right= '<span class="wp-admin-bar-arrow-right" aria-hidden="true"></span>';530 if ( ! $is_root_top_item && ! $is_top_secondary_item && ! $is_top_secondary_tree && $is_parent ) { 531 $arrow = '<span class="wp-admin-bar-arrow-right" aria-hidden="true"></span>'; 496 532 } 533 // Print the left arrow icon for the secondary menu children with children. 534 elseif ( ! $is_root_top_item && ! $is_top_secondary_item && ! $is_root_top_tree && $is_parent ) { 535 $arrow = '<span class="wp-admin-bar-arrow-left" aria-hidden="true"></span>'; 536 } 497 537 498 538 if ( ! empty( $node->meta['class'] ) ) 499 539 $menuclass .= $node->meta['class']; … … 539 579 ?>><?php 540 580 endif; 541 581 542 echo $arrow _right. $node->title;582 echo $arrow . $node->title; 543 583 544 584 if ( $has_link ) : 545 585 ?></a><?php -
wp-includes/css/admin-bar.css
235 235 #wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon, 236 236 #wpadminbar .ab-icon, 237 237 #wpadminbar .ab-item:before, 238 .wp-admin-bar-arrow-left, 238 239 .wp-admin-bar-arrow-right { 239 240 position: relative; 240 241 float: left; … … 313 314 color: #00b9eb; 314 315 } 315 316 317 #wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow-left:before, 316 318 #wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow-right:before, 317 319 #wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before { 318 320 position: absolute; … … 327 329 padding-right: 2em; 328 330 } 329 331 332 #wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow-left:before { 333 top: 1px; 334 left: 6px; 335 padding: 4px 0; 336 content: "\f141"; 337 color: inherit; 338 } 339 330 340 #wpadminbar .menupop .menupop > .ab-item .wp-admin-bar-arrow-right:before { 331 341 top: 1px; 332 342 right: 10px; … … 340 350 padding-right: 1em; 341 351 } 342 352 343 #wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before {344 top: 1px;345 left: 6px;346 content: "\f141";347 }348 349 353 #wpadminbar .quicklinks .menupop ul.ab-sub-secondary { 350 354 display: block; 351 355 position: relative;