# b-blocks/2.1.8/includes/StyleGenerator.php

bBlocks – Essential Gutenberg Blocks &amp; Patterns Collection, version 2.1.8. 35 lines.

- Page: https://pluginprobe.com/plugins/b-blocks/2.1.8/code/includes/StyleGenerator.php
- Raw: https://pluginprobe.com/plugins/b-blocks/2.1.8/raw/includes/StyleGenerator.php
- Modified: 2026-09-27T04:52:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/b-blocks/2.1.8/code/includes/StyleGenerator.php#L10-L20`.

```php
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class BBlocksStyleGenerator
{
	public static $styles = [];
	public static function addStyle($selector, $styles)
	{
		if (array_key_exists($selector, self::$styles)) {
			self::$styles[$selector] = wp_parse_args(self::$styles[$selector], $styles);
		} else {
			self::$styles[$selector] = $styles;
		}
	}
	public static function renderStyle()
	{
		$output = '';
		foreach (self::$styles as $selector => $style) {
			$new = '';
			foreach ($style as $property => $value) {
				if ( '' === $value ) {
					$new .= "$property ;";
				} else {
					$new .= " $property: $value;";
				}
			}
			$output .= "$selector { $new }";
		}
		return $output;
	}
}

```
