Astra_Gutenberg::add_inherit_width_group_class( string $block_content, array $block )

Add Group block custom class when “Inherit default layout” toggle enabled.


Description


Parameters

$block_content

(string) (Required) Rendered block content.

$block

(array) (Required) Block object.


Return

(string) Filtered block content.


Source

File: inc/compatibility/class-astra-gutenberg.php

	public function add_inherit_width_group_class( $block_content, $block ) {
		if (
			isset( $block['blockName'] ) && isset( $block['attrs']['layout']['inherit'] ) && $block['attrs']['layout']['inherit']
		) {
			$block_classgroups    = isset( $block['attrs']['className'] ) ? $block['attrs']['className'] : '';
			$processed_classnmaes = $block_classgroups . ' inherit-container-width';

			$block_content = preg_replace(
				'/' . preg_quote( 'class="', '/' ) . '/',
				'class="inherit-container-width ',
				$block_content,
				1
			);
		}

		return $block_content;
	}

Changelog

Changelog
Version Description
3.8.3 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.