Changeset 48398 for trunk/src/wp-admin/includes/class-wp-screen.php
- Timestamp:
- 07/07/2020 07:10:46 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-screen.php
r47802 r48398 1289 1289 $screen = get_current_screen(); 1290 1290 1291 // Currently only enabled for posts lists.1292 if ( 'edit' !== $screen->base ) {1291 // Currently only enabled for posts and comments lists. 1292 if ( 'edit' !== $screen->base && 'edit-comments' !== $screen->base ) { 1293 1293 return; 1294 1294 } 1295 1295 1296 $view_mode_post_types = get_post_types( 1297 array( 1298 'hierarchical' => false, 1299 'show_ui' => true, 1300 ) 1301 ); 1296 $view_mode_post_types = get_post_types( array( 'show_ui' => true ) ); 1302 1297 1303 1298 /** … … 1307 1302 * 1308 1303 * @param string[] $view_mode_post_types Array of post types that can change view modes. 1309 * Default non-hierarchicalpost types with show_ui on.1304 * Default post types with show_ui on. 1310 1305 */ 1311 1306 $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); 1312 1307 1313 if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) {1308 if ( 'edit' === $screen->base && ! in_array( $this->post_type, $view_mode_post_types, true ) ) { 1314 1309 return; 1315 1310 } 1316 1311 1317 global $mode; 1312 $mode = get_user_setting( 'posts_list_mode', 'list' ); 1313 1314 // Set 'list' as default value if $mode is not set. 1315 $mode = ( isset( $mode ) && 'extended' === $mode ) ? 'extended' : 'list'; 1316 1317 /** 1318 * Filters the current view mode. 1319 * 1320 * @since 5.5.0 1321 * 1322 * @param string $mode The current selected mode. Default value of 1323 * posts_list_mode user setting. 1324 */ 1325 $mode = apply_filters( 'table_view_mode', $mode ); 1318 1326 1319 1327 // This needs a submit button. … … 1324 1332 <label for="list-view-mode"> 1325 1333 <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> 1326 <?php _e( ' List View' ); ?>1334 <?php _e( 'Compact view' ); ?> 1327 1335 </label> 1328 1336 <label for="excerpt-view-mode"> 1329 <input id="excerpt-view-mode" type="radio" name="mode" value="ex cerpt" <?php checked( 'excerpt', $mode ); ?> />1330 <?php _e( 'Ex cerptView' ); ?>1337 <input id="excerpt-view-mode" type="radio" name="mode" value="extended" <?php checked( 'extended', $mode ); ?> /> 1338 <?php _e( 'Extended View' ); ?> 1331 1339 </label> 1340 <?php 1341 /** 1342 * Fires at the end of the table view modes screen option. 1343 * 1344 * @since 5.5.0 1345 * 1346 * @param string $mode The currently selected mode. 1347 */ 1348 do_action( 'wp_table_view_modes', $mode ); 1349 ?> 1332 1350 </fieldset> 1333 1351 <?php
Note: See TracChangeset
for help on using the changeset viewer.