0 && count( $fields ) > $max_fields ) { $fields = array_slice( $fields, 0, $max_fields ); } // Return empty on frontend if no fields (hide block). if ( empty( $fields ) ) { return ''; } // Get block wrapper attributes. $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'activitypub-extra-fields-block-wrapper', ) ); // Extract background color for cards style. $background_color = ''; $card_style = ''; // Check if this is the cards style by looking at className attribute or wrapper classes. $is_cards_style = ( isset( $attributes['className'] ) && str_contains( $attributes['className'], 'is-style-cards' ) ) || str_contains( $wrapper_attributes, 'is-style-cards' ); if ( $is_cards_style ) { // Check for background color in various formats. if ( isset( $attributes['backgroundColor'] ) ) { $background_color = sprintf( 'var(--wp--preset--color--%s)', $attributes['backgroundColor'] ); } elseif ( isset( $attributes['style']['color']['background'] ) ) { $background_color = $attributes['style']['color']['background']; } if ( $background_color ) { $card_style = sprintf( ' style="background-color: %s;"', esc_attr( $background_color ) ); } } ?>