Changeset 12870
- Timestamp:
- 08/29/2023 08:27:30 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/flagged.php
r12868 r12870 28 28 */ 29 29 public static function init() { 30 $post_type = Registrations::get_post_type(); 31 30 32 // Register post statuses. 31 33 add_action( 'init', [ __CLASS__, 'register_post_statuses' ] ); … … 52 54 // Add support to the post edit page. 53 55 add_action( 'admin_footer-post.php', [ __CLASS__, 'output_js_for_post_edit_support' ] ); 56 57 // Add an unlinked 'Flagged (n)' label alongside the table view links. 58 add_filter( "views_edit-{$post_type}", [ __CLASS__, 'add_unlinked_flagged_status' ] ); 54 59 55 60 // Add support to quick edit and bulk edit. … … 339 344 340 345 /** 346 * Adds an unlinked 'Flagged (n)' status and count to the view links for a 347 * photos post listing for non-Photo Admins. 348 * 349 * Photo Admins automatically see a linked version of the link because they 350 * have access to the listing. Since Moderators don't have that access, this 351 * at least shows them that the current number of flagged photos. 352 * 353 * @param string[] $views An array of available list table views. 354 * @return string[] 355 */ 356 public static function add_unlinked_flagged_status( $views ) { 357 $flagged_count = self::count(); 358 if ( ! $flagged_count ) { 359 return $views; 360 } 361 362 $flagged_status = self::get_post_status(); 363 if ( filter_input( INPUT_GET, 'post_type' ) === Registrations::get_post_type() ) { 364 if ( empty( $views[ $flagged_status ] ) ) { 365 $views[ $flagged_status ] = sprintf( 366 _n( 'Flagged <span class="count">(%s)</span>', 'Flagged <span class="count">(%s)</span>', $flagged_count, 'wporg-photos' ), 367 number_format_i18n( $flagged_count ) 368 ); 369 } 370 } 371 372 return $views; 373 } 374 375 /** 341 376 * Adds custom post statuses to the Quick Edit panel. 342 377 *
Note: See TracChangeset
for help on using the changeset viewer.