@@ -438,23 +438,37 @@ public static function render_moderation_section_description() {
438438 */
439439 public static function render_site_blocked_domains_field () {
440440 $ blocked_domains = Moderation::get_site_blocks ()['domains ' ];
441+ $ count = \count ( $ blocked_domains );
441442 ?>
442443 <p class="description"><?php \esc_html_e ( 'Block entire ActivityPub instances by domain name. ' , 'activitypub ' ); ?> </p>
443444
444445 <div class="activitypub-site-block-list">
445446 <?php if ( ! empty ( $ blocked_domains ) ) : ?>
446- <table class="widefat striped activitypub-site-blocked-domain" role="presentation" style="max-width: 500px; margin: 15px 0;">
447- <?php foreach ( $ blocked_domains as $ domain ) : ?>
448- <tr>
449- <td><?php echo \esc_html ( $ domain ); ?> </td>
450- <td style="width: 80px;">
451- <button type="button" class="button button-small remove-site-block-btn" data-type="domain" data-value="<?php echo \esc_attr ( $ domain ); ?> ">
452- <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
453- </button>
454- </td>
455- </tr>
456- <?php endforeach ; ?>
457- </table>
447+ <details style="margin: 10px 0;">
448+ <summary style="cursor: pointer; padding: 8px 0; color: inherit;">
449+ <?php
450+ echo \esc_html (
451+ \sprintf (
452+ /* translators: %s: Number of blocked domains */
453+ \_n ( '%s blocked domain ' , '%s blocked domains ' , $ count , 'activitypub ' ),
454+ \number_format_i18n ( $ count )
455+ )
456+ );
457+ ?>
458+ </summary>
459+ <table class="widefat striped activitypub-site-blocked-domain" role="presentation" style="max-width: 500px; margin-top: 10px;">
460+ <?php foreach ( $ blocked_domains as $ domain ) : ?>
461+ <tr>
462+ <td><?php echo \esc_html ( $ domain ); ?> </td>
463+ <td style="width: 80px;">
464+ <button type="button" class="button button-small remove-site-block-btn" data-type="domain" data-value="<?php echo \esc_attr ( $ domain ); ?> ">
465+ <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
466+ </button>
467+ </td>
468+ </tr>
469+ <?php endforeach ; ?>
470+ </table>
471+ </details>
458472 <?php endif ; ?>
459473
460474 <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;">
@@ -472,23 +486,37 @@ public static function render_site_blocked_domains_field() {
472486 */
473487 public static function render_site_blocked_keywords_field () {
474488 $ blocked_keywords = Moderation::get_site_blocks ()['keywords ' ];
489+ $ count = \count ( $ blocked_keywords );
475490 ?>
476491 <p class="description"><?php \esc_html_e ( 'Block ActivityPub content containing specific keywords. ' , 'activitypub ' ); ?> </p>
477492
478493 <div class="activitypub-site-block-list">
479494 <?php if ( ! empty ( $ blocked_keywords ) ) : ?>
480- <table class="widefat striped activitypub-site-blocked-keyword" role="presentation" style="max-width: 500px; margin: 15px 0;">
481- <?php foreach ( $ blocked_keywords as $ keyword ) : ?>
482- <tr>
483- <td><?php echo \esc_html ( $ keyword ); ?> </td>
484- <td style="width: 80px;">
485- <button type="button" class="button button-small remove-site-block-btn" data-type="keyword" data-value="<?php echo \esc_attr ( $ keyword ); ?> ">
486- <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
487- </button>
488- </td>
489- </tr>
490- <?php endforeach ; ?>
491- </table>
495+ <details style="margin: 10px 0;">
496+ <summary style="cursor: pointer; padding: 8px 0; color: inherit;">
497+ <?php
498+ echo \esc_html (
499+ \sprintf (
500+ /* translators: %s: Number of blocked keywords */
501+ \_n ( '%s blocked keyword ' , '%s blocked keywords ' , $ count , 'activitypub ' ),
502+ \number_format_i18n ( $ count )
503+ )
504+ );
505+ ?>
506+ </summary>
507+ <table class="widefat striped activitypub-site-blocked-keyword" role="presentation" style="max-width: 500px; margin-top: 10px;">
508+ <?php foreach ( $ blocked_keywords as $ keyword ) : ?>
509+ <tr>
510+ <td><?php echo \esc_html ( $ keyword ); ?> </td>
511+ <td style="width: 80px;">
512+ <button type="button" class="button button-small remove-site-block-btn" data-type="keyword" data-value="<?php echo \esc_attr ( $ keyword ); ?> ">
513+ <?php \esc_html_e ( 'Remove ' , 'activitypub ' ); ?>
514+ </button>
515+ </td>
516+ </tr>
517+ <?php endforeach ; ?>
518+ </table>
519+ </details>
492520 <?php endif ; ?>
493521
494522 <div class="add-site-block-form" style="display: flex; max-width: 500px; gap: 8px;">
0 commit comments