Changeset 19944
- Timestamp:
- 02/17/2012 11:40:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/screen.php
r19943 r19944 581 581 582 582 /** 583 * Gets the help tabs registered for the screen. 584 * 585 * @since 3.4.0 586 * 587 * @return array Help tabs with arguments. 588 */ 589 public function get_help_tabs() { 590 return $this->_help_tabs; 591 } 592 593 /** 594 * Gets the arguments for a help tab. 595 * 596 * @since 3.4.0 597 * 598 * @param string $id Help Tab ID. 599 * @return array Help tab arguments. 600 */ 601 public function get_help_tab( $id ) { 602 if ( ! isset( $this->_help_tabs[ $id ] ) ) 603 return null; 604 return $this->_help_tabs[ $id ]; 605 } 606 607 /** 583 608 * Add a help tab to the contextual help for the screen. 584 609 * Call this on the load-$pagenow hook for the relevant screen. … … 608 633 return; 609 634 610 $this->_help_tabs[] = $args; 635 // Allows for overriding an existing tab with that ID. 636 $this->_help_tabs[ $args['id'] ] = $args; 611 637 } 612 638 … … 632 658 633 659 /** 660 * Gets the content from a contextual help sidebar. 661 * 662 * @since 3.4.0 663 * 664 */ 665 public function get_help_sidebar() { 666 return $this->_help_sidebar; 667 } 668 669 /** 634 670 * Add a sidebar to the contextual help for the screen. 635 671 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help. … … 659 695 660 696 // Default help only if there is no old-style block of text and no new-style help tabs. 661 if ( empty( $old_help ) && empty( $this->_help_tabs) ) {697 if ( empty( $old_help ) && ! $this->get_help_tabs() ) { 662 698 $default_help = apply_filters( 'default_contextual_help', '' ); 663 699 if ( $default_help ) … … 673 709 } 674 710 675 $h as_sidebar = ! empty( $this->_help_sidebar);711 $help_sidebar = $this->get_help_sidebar(); 676 712 677 713 $help_class = 'hidden'; 678 if ( ! $h as_sidebar )714 if ( ! $help_sidebar ) 679 715 $help_class .= ' no-sidebar'; 680 716 … … 688 724 <div class="contextual-help-tabs"> 689 725 <ul> 690 <?php foreach ( $this->_help_tabs as $i => $tab ): 726 <?php 727 $class = ' class="active"'; 728 foreach ( $this->get_help_tabs() as $tab ) : 691 729 $link_id = "tab-link-{$tab['id']}"; 692 730 $panel_id = "tab-panel-{$tab['id']}"; 693 $classes = ( $i == 0 ) ? 'active' : '';694 731 ?> 695 732 696 <li id="<?php echo esc_attr( $link_id ); ?>" class="<?php echo esc_attr( $classes ); ?>">733 <li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>"> 697 734 <a href="<?php echo esc_url( "#$panel_id" ); ?>"> 698 735 <?php echo esc_html( $tab['title'] ); ?> 699 736 </a> 700 737 </li> 701 <?php endforeach; ?> 738 <?php 739 $class = ''; 740 endforeach; 741 ?> 702 742 </ul> 703 743 </div> 704 744 705 <?php if ( $h as_sidebar ) : ?>745 <?php if ( $help_sidebar ) : ?> 706 746 <div class="contextual-help-sidebar"> 707 <?php echo $ this->_help_sidebar; ?>747 <?php echo $help_sidebar; ?> 708 748 </div> 709 749 <?php endif; ?> 710 750 711 751 <div class="contextual-help-tabs-wrap"> 712 <?php foreach ( $this->_help_tabs as $i => $tab ): 752 <?php 753 $classes = 'help-tab-content active'; 754 foreach ( $this->get_help_tabs() as $tab ): 713 755 $panel_id = "tab-panel-{$tab['id']}"; 714 $classes = ( $i == 0 ) ? 'active' : '';715 $classes .= ' help-tab-content';716 756 ?> 717 757 718 <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo esc_attr( $classes ); ?>">758 <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>"> 719 759 <?php 720 760 // Print tab content. … … 726 766 ?> 727 767 </div> 728 <?php endforeach; ?> 768 <?php 769 $classes = 'help-tab-content'; 770 endforeach; 771 ?> 729 772 </div> 730 773 </div> … … 737 780 </div> 738 781 <?php 739 if ( ! $this-> _help_tabs&& ! $this->show_screen_options() )782 if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) 740 783 return; 741 784 ?> 742 785 <div id="screen-meta-links"> 743 <?php if ( $this-> _help_tabs) : ?>786 <?php if ( $this->get_help_tabs() ) : ?> 744 787 <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> 745 788 <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings"><?php _e( 'Help' ); ?></a>
Note: See TracChangeset
for help on using the changeset viewer.