'rooster-price-card rooster-price-card--' . $layout . ( $highlighted ? ' is-highlighted' : '' ),
'data-rooster-ui' => 'rooster-one/plan',
];
if ( ! empty( $attributes['anchor'] ) ) {
$wrapper_attrs['id'] = sanitize_title( (string) $attributes['anchor'] );
}
$wrapper = AIEO_Engine_Blocks::wrapper( $library, $wrapper_attrs );
$badge_html = '' !== $badge ? '' . esc_html( $badge ) . '' : '';
$level = min( 6, max( 2, (int) ( $attributes['level'] ?? 3 ) ) );
$name_html = '' !== $name ? sprintf( '%2$s', $level, esc_html( $name ) ) : '';
$tagline_html = '' !== $tagline ? '
' . esc_html( $tagline ) . '
' : '';
$price_html = '' !== $price
? '' . esc_html( $price ) . ( '' !== $period ? ' ' . esc_html( $period ) . '' : '' ) . '
'
: '';
$note_html = '' !== $note ? '' . AIEO_Engine_Blocks::inline( $note ) . '
' : '';
$list_html = '';
if ( $features ) {
$list_html .= '';
foreach ( $features as $feature ) {
$excluded = str_starts_with( $feature, '-' );
$label = trim( $excluded ? substr( $feature, 1 ) : $feature );
if ( '' === $label ) {
continue;
}
$list_html .= '- '
. AIEO_Engine_Blocks::mark( $excluded ? 'no' : 'yes', $excluded ? __( 'Not included:', 'ai-eshop-optimizer' ) : __( 'Included:', 'ai-eshop-optimizer' ) )
. AIEO_Engine_Blocks::run( $label ) . '
';
}
$list_html .= '
';
}
if ( 'row' === $layout ) {
$inner = '' . $name_html . $badge_html . $price_html . $note_html . '
'
. ( '' !== $tagline_html . $list_html ? '' . $tagline_html . $list_html . '
' : '' );
} else {
$inner = $badge_html . $name_html . $tagline_html . $price_html . $note_html . $list_html;
}
if ( '' !== $cta && '' !== $cta_href ) {
$inner .= '' . esc_html( $cta ) . '';
}
AIEO_Engine_Blocks::out( sprintf( '%s', $wrapper, $inner ) );