20, 'height' => 20, 'class' => 'rooster-action-panel__glyph' ] ) : ''; $chip = '' !== $chip ? '' . $chip . '' : ''; $glyphs = static function ( string $slug, int $size ): array { $slug = sanitize_key( $slug ); if ( 'arrow-right' === $slug ) { return [ '', '' ]; } return [ '' !== $slug && 'none' !== $slug && function_exists( 'rooster_icon' ) ? rooster_icon( $slug, [ 'width' => $size, 'height' => $size, 'class' => 'rooster-action-panel__icon' ] ) : '', '' ]; }; if ( 'wash' === $layout || 'ink' === $layout ) { $body = $chip; if ( '' !== $eyebrow ) { $body .= '
' . esc_html( $eyebrow ) . '
'; } if ( '' !== $heading ) { $body .= sprintf( '' . AIEO_Engine_Blocks::inline( trim( $para ) ) . '
'; } } $lines = (string) ( $attributes['buttons'] ?? '' ); if ( 'ink' === $layout ) { $body .= '' !== trim( $lines ) ? (string) render_block( [ 'blockName' => 'rooster/action', 'attrs' => [ 'variant' => 'buttons', 'buttons' => $lines, 'tone' => (string) ( $attributes['tone'] ?? '' ) ], 'innerBlocks' => [], 'innerHTML' => '', 'innerContent' => [] ] ) : ''; } else { $links = ''; foreach ( AIEO_Engine_Blocks::lines( $lines ) as $line ) { $parts = array_map( 'trim', explode( '|', $line ) ); if ( '' !== (string) ( $parts[0] ?? '' ) && '' !== (string) ( $parts[1] ?? '' ) ) { $other = (string) wp_parse_url( (string) $parts[1], PHP_URL_HOST ); $away = '' !== $other && $other !== $host; [ $before, $after ] = $glyphs( (string) ( $parts[3] ?? '' ), 16 ); $links .= '' . $before . esc_html( (string) $parts[0] ) . ( $away ? ' ' . esc_html__( '(opens in a new tab)', 'ai-eshop-optimizer' ) . '' : '' ) . $after . ''; } } $body .= '' !== $links ? '' . AIEO_Engine_Blocks::inline( $note ) . '
'; } $wrapper = AIEO_Engine_Blocks::wrapper( $library, [ 'class' => 'rooster-action-panel rooster-action-panel--' . $layout, 'data-rooster-ui' => 'rooster-one/action' ] ); AIEO_Engine_Blocks::out( sprintf( '' . esc_html( $eyebrow ) . '
'; } if ( '' !== $heading ) { $body .= sprintf( '' . AIEO_Engine_Blocks::inline( $text ) . '
'; } $items = 'band' === $layout ? AIEO_Engine_Blocks::lines( (string) ( $attributes['items'] ?? '' ) ) : []; if ( $items ) { $body .= '