# elementor/4.3.2/modules/atomic-widgets/styles/local-style-serializer.php

Elementor Website Builder – more than just a page builder, version 4.3.2. 39 lines.

- Page: https://pluginprobe.com/plugins/elementor/4.3.2/code/modules/atomic-widgets/styles/local-style-serializer.php
- Raw: https://pluginprobe.com/plugins/elementor/4.3.2/raw/modules/atomic-widgets/styles/local-style-serializer.php
- Modified: 2026-09-01T11:47:36+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/elementor/4.3.2/code/modules/atomic-widgets/styles/local-style-serializer.php#L10-L20`.

```php
<?php

namespace Elementor\Modules\AtomicWidgets\Styles;

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

/**
 * Projects an element's stored `styles` map into the MCP round-trip shape:
 *
 *   [
 *     '__style_id' => 'e-widget1-abc1234',
 *     'css'        => 'color: red; &:hover { color: blue; } @media(--mobile) { ... }',
 *   ]
 *
 * The `css` value follows the same raw CSS format that the write-side tools
 * (manage-classes, manage-elements.update.style, build-composition.style)
 * accept as input, so consumers can round-trip styles without transformation.
 *
 * Rendering itself is delegated to `Local_Style` / `Local_Style_Variant` so each
 * domain object owns its own CSS output — the serializer only adapts the shape.
 */
class Local_Style_Serializer {

	public static function serialize( array $styles ): array {
		$local_style = Local_Style::from_styles_map( $styles );

		if ( null === $local_style ) {
			return [];
		}

		return [
			'__style_id' => $local_style->id(),
			'css'        => $local_style->to_css(),
		];
	}
}

```
