# elementor/4.3.0-beta3/modules/components/variants/component-variant-class-collector.php

Elementor Website Builder – more than just a page builder, version 4.3.0-beta3. 32 lines.

- Page: https://pluginprobe.com/plugins/elementor/4.3.0-beta3/code/modules/components/variants/component-variant-class-collector.php
- Raw: https://pluginprobe.com/plugins/elementor/4.3.0-beta3/raw/modules/components/variants/component-variant-class-collector.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.0-beta3/code/modules/components/variants/component-variant-class-collector.php#L10-L20`.

```php
<?php

namespace Elementor\Modules\Components\Variants;

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

class Component_Variant_Class_Collector {
	public static function collect( Component_Variants $variants ): array {
		$class_ids = [];

		foreach ( $variants->variants as $variant ) {
			foreach ( $variant->widgets as $widget_entry ) {
				$add_list = $widget_entry['settings']['classes'][ Component_Variant_Parser::ACTION_ADD ] ?? [];

				if ( ! is_array( $add_list ) ) {
					continue;
				}

				foreach ( $add_list as $class_id ) {
					if ( is_string( $class_id ) && '' !== $class_id ) {
						$class_ids[] = $class_id;
					}
				}
			}
		}

		return $class_ids;
	}
}

```
