| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | if ( ! class_exists( 'WP_List_Table' ) ) { |
| 7 | 4 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; // since WP 3.1 |
| 8 | 5 | } |
| @@ -94,23 +91,26 @@ | ||
| 94 | 91 | * |
| 95 | 92 | * @param object $item The current item |
| 96 | 93 | */ |
| 97 | 94 | protected function single_row_columns( $item ) { |
| 98 | - $column_info = $this->get_column_info(); | |
| 99 | - $columns = $column_info[0]; | |
| 100 | - $primary = $column_info[3]; | |
| 95 | + list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); | |
| 101 | 96 | |
| 102 | - foreach ( array_keys( $columns ) as $column_name ) { | |
| 97 | + foreach ( $columns as $column_name => $column_display_name ) { | |
| 103 | 98 | $classes = "$column_name column-$column_name"; |
| 104 | 99 | if ( $primary === $column_name ) { |
| 105 | 100 | $classes .= ' column-primary'; |
| 106 | 101 | } |
| 107 | 102 | |
| 103 | + if ( in_array( $column_name, $hidden ) ) { | |
| 104 | + $classes .= ' hidden'; | |
| 105 | + } | |
| 106 | + | |
| 108 | 107 | if ( 'cb' == $column_name ) { |
| 109 | 108 | echo '<th scope="row" class="check-column">'; |
| 110 | 109 | echo $this->column_cb( $item ); // phpcs:ignore WordPress.Security.EscapeOutput |
| 111 | 110 | echo '</th>'; |
| 112 | - } else { | |
| 111 | + } | |
| 112 | + else { | |
| 113 | 113 | printf( '<td class="%s">', esc_attr( $classes ) ); |
| 114 | 114 | echo $this->column_default( $item, $column_name ); // phpcs:ignore WordPress.Security.EscapeOutput |
| 115 | 115 | echo '</td>'; |
| 116 | 116 | } |
| @@ -167,16 +167,8 @@ | ||
| 167 | 167 | * @param array $items |
| 168 | 168 | */ |
| 169 | 169 | public function prepare_items( $items = array() ) { |
| 170 | 170 | $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns(), $this->get_primary_column_name() ); |
| 171 | - | |
| 172 | - // Sort rows, lowest priority on top. | |
| 173 | - usort( | |
| 174 | - $items, | |
| 175 | - function( $a, $b ) { | |
| 176 | - return $a->priority > $b->priority ? 1 : -1; | |
| 177 | - } | |
| 178 | - ); | |
| 179 | 171 | $this->items = $items; |
| 180 | 172 | } |
| 181 | 173 | |
| 182 | 174 | /** |