WPSEO_Bulk_Title_Editor_List_Table

Implements table for bulk title editing.

Defined (1)

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

/admin/class-bulk-title-editor-list-table.php  
  1. class WPSEO_Bulk_Title_Editor_List_Table extends WPSEO_Bulk_List_Table { 
  2.  
  3. /** 
  4. * Current type for this class will be title 
  5. * @var string 
  6. */ 
  7. protected $page_type = 'title'; 
  8.  
  9.  
  10. /** 
  11. * Settings with are used in __construct 
  12. * @var array 
  13. */ 
  14. protected $settings = array( 
  15. 'singular' => 'wpseo_bulk_title',  
  16. 'plural' => 'wpseo_bulk_titles',  
  17. 'ajax' => true,  
  18. ); 
  19.  
  20. /** 
  21. * The field in the database where meta field is saved. 
  22. * @var string 
  23. */ 
  24. protected $target_db_field = 'title'; 
  25.  
  26. /** 
  27. * The columns shown on the table 
  28. * @return array 
  29. */ 
  30. public function get_columns() { 
  31.  
  32. $columns = array( 
  33. /** translators: %1$s expands to Yoast SEO */ 
  34. 'col_existing_yoast_seo_title' => sprintf( __( 'Existing %1$s Title', 'wordpress-seo' ), 'Yoast SEO' ),  
  35. /** translators: %1$s expands to Yoast SEO */ 
  36. 'col_new_yoast_seo_title' => sprintf( __( 'New %1$s Title', 'wordpress-seo' ), 'Yoast SEO' ),  
  37. ); 
  38.  
  39. return $this->merge_columns( $columns ); 
  40.  
  41. /** 
  42. * Parse the title columns 
  43. * @param string $column_name Column name. 
  44. * @param object $record Data object. 
  45. * @param string $attributes HTML attributes. 
  46. * @return string 
  47. */ 
  48. protected function parse_page_specific_column( $column_name, $record, $attributes ) { 
  49.  
  50. // Fill meta data if exists in $this->meta_data. 
  51. $meta_data = ( ! empty( $this->meta_data[ $record->ID ] ) ) ? $this->meta_data[ $record->ID ] : array(); 
  52.  
  53. switch ( $column_name ) { 
  54. case 'col_existing_yoast_seo_title': 
  55. // TODO inconsistent echo/return behavior R. 
  56. echo $this->parse_meta_data_field( $record->ID, $attributes ); 
  57. break; 
  58.  
  59. case 'col_new_yoast_seo_title': 
  60. return sprintf( 
  61. '<input type="text" id="%1$s" name="%1$s" class="wpseo-new-title" data-id="%2$s" aria-labelledby="col_new_yoast_seo_title" />',  
  62. 'wpseo-new-title-' . $record->ID,  
  63. $record->ID 
  64. ); 
  65. break; 
  66.  
  67. unset( $meta_data ); 
  68. } /** End of class */