• File: default-style-data-normalizer.php
  • Full Path: /home/slvgwrnz/public_html/wp-content/plugins/elementor/modules/default-styles/utils/default-style-data-normalizer.php
  • Date Modified: 09/01/2026 8:47 AM
  • File size: 596 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

namespace Elementor\Modules\DefaultStyles\Utils;

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

class Default_Style_Data_Normalizer {
	const CSS_NAME_PREFIX = 'e-default-';

	public static function normalize_style( string $tag, array $data ): array {
		return array_merge(
			[
				'id' => $tag,
				'label' => $tag,
				'cssName' => self::CSS_NAME_PREFIX . $tag,
			],
			self::normalize_style_fields( $data )
		);
	}

	public static function normalize_style_fields( array $item ): array {
		return [
			'type' => $item['type'] ?? 'class',
			'variants' => $item['variants'] ?? [],
		];
	}
}