diff --git a/classes/class-list-table.php b/classes/class-list-table.php index 64f8dddd7..2ae9ad6b6 100644 --- a/classes/class-list-table.php +++ b/classes/class-list-table.php @@ -391,37 +391,33 @@ public function column_default( $item, $column_name ) { * Registers new Columns to be inserted into the table. The cell contents of this column is set * below with 'wp_stream_insert_column_default_' * - * @param array $new_columns Columns injected in the table. + * @since 3.5.1 + * @deprecated 4.0.1 Use the {@see 'wp_stream_list_table_columns'} filter instead. + * + * @param array $new_columns Columns injected in the table. * * @return array */ - $inserted_columns = apply_filters( 'wp_stream_register_column_defaults', array() ); - - if ( ! empty( $inserted_columns ) && is_array( $inserted_columns ) ) { - foreach ( $inserted_columns as $column_title ) { - /** - * If column title inserted via wp_stream_register_column_defaults ($column_title) exists - * among columns registered with get_columns ($column_name) and there is an action associated - * with this column, do the action - * - * Also, note that the action name must include the $column_title registered - * with wp_stream_register_column_defaults - */ - if ( $column_title === $column_name ) { - /** - * Allows for the addition of content under a specified column. - * - * @param string $out Column content. - * @param object $record Record with row content. - * @param string $column_name Column name. - * - * @return string - */ - $out = apply_filters( "wp_stream_insert_column_default_{$column_title}", $out, $record, $column_name ); - break; - } - } - } + apply_filters_deprecated( + 'wp_stream_register_column_defaults', + array( array() ), + /* translators: %s is the Stream version number. It is part of a filter deprecation notice and is preceded by: "{hook_name} is deprecated since version %s of Stream". */ + sprintf( __( '%s of Stream', 'stream' ), '4.0.1' ), + 'wp_stream_list_table_columns', + __( 'This filter is being deprecated as it is redundant. You can define custom column names and titles using the `wp_stream_list_table_columns` filter then provide the value for the custom columns using the `wp_stream_insert_column_default_{$column_name}` filter.', 'stream' ) + ); + + /** + * Allows for the addition of content under a specified column. + * + * @param string $out Column content. + * @param object $record Record with row content. + * @param string $column_name Column name. + * + * @return string + */ + $out = (string) apply_filters( "wp_stream_insert_column_default_{$column_name}", $out, $record, $column_name ); + break; } $allowed_tags = wp_kses_allowed_html( 'post' ); diff --git a/ui/css/admin.css b/ui/css/admin.css index ec9e1b737..8acceff23 100644 --- a/ui/css/admin.css +++ b/ui/css/admin.css @@ -86,12 +86,15 @@ } .toplevel_page_wp_stream .column-date { - min-width: 10%; + width: 120px; white-space: nowrap; } .toplevel_page_wp_stream .column-date .timeago { - padding-right: 1em; + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; } .toplevel_page_wp_stream .column-user_id { @@ -102,6 +105,17 @@ width: auto; } +/* +Ensure the summary column is not squeezed if there are custom columns added. + +This is because columns width is set to 12% by default (above). Adding a single +custom column leaves less space for the auto-width summary column. Having 2 or +more custom columns squeezes the summary column to a narrow strip. +*/ +.toplevel_page_wp_stream :where(.wp-list-table tr:has(> *:nth-child(7))) .column-summary { + width: 30%; +} + .toplevel_page_wp_stream .column-ip { white-space: nowrap; overflow: hidden;