WPSEO_Option_Tabs_Formatter

Class WPSEO_Option_Tabs_Formatter.

Defined (1)

The class is defined in the following location(s).

/admin/class-option-tabs-formatter.php  
  1. class WPSEO_Option_Tabs_Formatter { 
  2.  
  3. /** 
  4. * @param WPSEO_Option_Tabs $option_tabs Option Tabs to get base from. 
  5. * @param WPSEO_Option_Tab $tab Tab to get name from. 
  6. * @return string 
  7. */ 
  8. public function get_tab_view( WPSEO_Option_Tabs $option_tabs, WPSEO_Option_Tab $tab ) { 
  9. return WPSEO_PATH . 'admin/views/tabs/' . $option_tabs->get_base() . '/' . $tab->get_name() . '.php'; 
  10.  
  11. /** 
  12. * @param WPSEO_Option_Tabs $option_tabs Option Tabs to get tabs from. 
  13. * @param Yoast_Form $yform Yoast Form which is being used in the views. 
  14. * @param array $options Options which are being used in the views. 
  15. */ 
  16. public function run( WPSEO_Option_Tabs $option_tabs, Yoast_Form $yform, $options = array() ) { 
  17.  
  18. echo '<h2 class="nav-tab-wrapper" id="wpseo-tabs">'; 
  19. foreach ( $option_tabs->get_tabs() as $tab ) { 
  20. printf( '<a class="nav-tab" id="%1$s-tab" href="#top#%1$s">%2$s</a>', $tab->get_name(), $tab->get_label() ); 
  21. echo '</h2>'; 
  22.  
  23. foreach ( $option_tabs->get_tabs() as $tab ) { 
  24. // Prepare the help center for each tab. 
  25. $help_center = new WPSEO_Help_Center( $option_tabs->get_base(), $tab ); 
  26.  
  27. $identifier = $tab->get_name(); 
  28. printf( '<div id="%s" class="wpseotab">', $identifier ); 
  29.  
  30. // Output the help center. 
  31. $help_center->output_help_center(); 
  32.  
  33. // Output the settings view for all tabs. 
  34. $tab_view = $this->get_tab_view( $option_tabs, $tab ); 
  35. if ( is_file( $tab_view ) ) { 
  36. require_once $tab_view; 
  37.  
  38. echo '</div>';