HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/wp-content/plugins/breadly/block-extensions/core-gallery.php
<?php
add_filter( 'render_block_core/gallery', 'gtm_render_block_core_gallery', 10, 2 );

function gtm_render_block_core_gallery( $block_content, $block ) {
	if ( ! empty( $block_content ) ) {
		if ( gtm_has_class( 'is-style-gtm-core-gallery-slider', $block['attrs']['className'] ?? '' ) ) {
			$swiper_params = [
				'breakpoints' => [
					768 => [
						"slidesPerView" => $block['attrs']['columns'] ?? 1,
					],
				],
			];

			$block_content = gtm_create_slider( $block_content, $swiper_params );

		} else if ( gtm_has_class( 'is-style-gtm-core-gallery-slider-flex', $block['attrs']['className'] ?? '' ) ) {
			$swiper_params = [
				"slidesPerView" => 'auto',
			];

			$block_content = gtm_create_slider( $block_content, $swiper_params );
		}
	}

	return $block_content;
}