Changeset 10040
- Timestamp:
- 07/08/2020 10:54:18 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-block-plugin-checker.php
r10038 r10040 441 441 $this->record_result( 442 442 __FUNCTION__, 443 'info', 443 // Over 15 blocks is probably too many. 444 count( $this->blocks ) < 15 ? 'info' : 'warning', 444 445 sprintf( 445 446 // translators: %d number of blocks. … … 501 502 ); 502 503 } 504 } 505 } 506 507 /** 508 * Check for a single parent block 509 */ 510 function check_for_single_parent() { 511 if ( empty( $this->blocks ) || ! is_array( $this->blocks ) ) { 512 return; 513 } 514 515 $top_level_blocks = array_filter( 516 $this->blocks, 517 function( $block ) { 518 return ! isset( $block->parent ) || is_null( $block->parent ); 519 } 520 ); 521 522 if ( count( $top_level_blocks ) > 1 ) { 523 $list = array_map( 524 function( $block ) { 525 return ! empty( $block->title ) ? $block->title : $block->name; 526 }, 527 $top_level_blocks 528 ); 529 $this->record_result( 530 __FUNCTION__, 531 'warning', 532 sprintf( 533 /* translators: %s is a list of block names. */ 534 __( 'More than one top level block was found: %s', 'wporg-plugins' ), 535 implode( ', ', $list ) 536 ), 537 $block_name 538 ); 503 539 } 504 540 }
Note: See TracChangeset
for help on using the changeset viewer.