Changeset 32644 for trunk/src/wp-admin/includes/class-wp-list-table.php
- Timestamp:
- 05/29/2015 02:40:52 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-list-table.php
r32642 r32644 796 796 797 797 /** 798 * Get name of default primary column 799 * 800 * @since 4.3.0 801 * @access protected 802 * 803 * @return string 804 */ 805 protected function get_default_primary_column_name() { 806 return ''; 807 } 808 809 /** 810 * Get name of primary column. 811 * 812 * @since 4.3.0 813 * @access protected 814 * 815 * @return string Filtered name of primary column 816 */ 817 protected function get_primary_column_name() { 818 $columns = $this->get_columns(); 819 $default = $this->get_default_primary_column_name(); 820 /** 821 * Filter the name of the primary column for the current list table, with context as argument (eg: 'plugins'). 822 * 823 * @since 4.3.0 824 * 825 * @param string $default Column name default for the specific list table (eg: 'name') 826 * @param string $context Screen ID for specific list table (eg: 'plugins') 827 */ 828 $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); 829 830 if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { 831 $column = $default; 832 } 833 834 return $column; 835 } 836 837 /** 798 838 * Get a list of all, hidden and sortable columns, with filter applied 799 839 * … … 835 875 } 836 876 837 $this->_column_headers = array( $columns, $hidden, $sortable ); 877 $primary = $this->get_primary_column_name(); 878 $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); 838 879 839 880 return $this->_column_headers; … … 1063 1104 */ 1064 1105 protected function single_row_columns( $item ) { 1065 list( $columns, $hidden ) = $this->get_column_info();1106 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); 1066 1107 1067 1108 foreach ( $columns as $column_name => $column_display_name ) { 1068 $class = "class='$column_name column-$column_name'"; 1109 $classes = "$column_name column-$column_name"; 1110 if ( $primary === $column_name ) { 1111 $classes .= ' has-row-actions column-primary'; 1112 } 1069 1113 1070 1114 $style = ''; 1071 if ( in_array( $column_name, $hidden ) ) 1115 if ( in_array( $column_name, $hidden ) ) { 1072 1116 $style = ' style="display:none;"'; 1073 1074 $attributes = "$class$style"; 1117 } 1118 1119 $attributes = "class='$classes'$style"; 1075 1120 1076 1121 if ( 'cb' == $column_name ) { … … 1082 1127 echo "<td $attributes>"; 1083 1128 echo call_user_func( array( $this, 'column_' . $column_name ), $item ); 1129 echo $this->handle_row_actions( $item, $column_name, $primary ); 1084 1130 echo "</td>"; 1085 1131 } … … 1087 1133 echo "<td $attributes>"; 1088 1134 echo $this->column_default( $item, $column_name ); 1135 echo $this->handle_row_actions( $item, $column_name, $primary ); 1089 1136 echo "</td>"; 1090 1137 } 1091 1138 } 1092 1139 } 1140 1141 /** 1142 * Generate and display row actions links 1143 * 1144 * @since 4.3.0 1145 * @access protected 1146 * 1147 * @param object $item Item being acted upon 1148 * @param string $column_name Current column name 1149 * @param string $primary Primary column name 1150 * 1151 * @return string 1152 */ 1153 protected function handle_row_actions( $item, $column_name, $primary ) { 1154 return ''; 1155 } 1093 1156 1094 1157 /**
Note: See TracChangeset
for help on using the changeset viewer.