Automattic\WooCommerce\Blocks\BlockTypes

AbstractProductGrid::get_container_classes()protectedWC 1.0

Get the list of classes to apply to this block.

Method of the class: AbstractProductGrid{}

No Hooks.

Return

String. space-separated list of classes.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_container_classes();

AbstractProductGrid::get_container_classes() code WC 9.4.2

protected function get_container_classes() {
	$classes = array(
		'wc-block-grid',
		"wp-block-{$this->block_name}",
		"wc-block-{$this->block_name}",
		"has-{$this->attributes['columns']}-columns",
	);

	if ( $this->attributes['rows'] > 1 ) {
		$classes[] = 'has-multiple-rows';
	}

	if ( isset( $this->attributes['align'] ) ) {
		$classes[] = "align{$this->attributes['align']}";
	}

	if ( ! empty( $this->attributes['alignButtons'] ) ) {
		$classes[] = 'has-aligned-buttons';
	}

	if ( ! empty( $this->attributes['className'] ) ) {
		$classes[] = $this->attributes['className'];
	}

	return implode( ' ', $classes );
}