# templately/3.4.7/includes/Builder/Factory/TemplateFactory.php

Templately – Elementor &amp; Gutenberg Template Library: 6500+ Free &amp; Pro Ready Templates And Cloud!, version 3.4.7. 34 lines.

- Page: https://pluginprobe.com/plugins/templately/3.4.7/code/includes/Builder/Factory/TemplateFactory.php
- Raw: https://pluginprobe.com/plugins/templately/3.4.7/raw/includes/Builder/Factory/TemplateFactory.php
- Modified: 2024-01-24T10:10:10+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/templately/3.4.7/code/includes/Builder/Factory/TemplateFactory.php#L10-L20`.

```php
<?php

namespace Templately\Builder\Factory;

use Elementor\Core\Base\Document;
use Templately\Builder\Source;

class TemplateFactory {
	protected $platform;

	protected $template;
	protected $template_manager;

	public function __construct( $platform = 'elementor' ) {
		$this->platform         = $platform;
		$this->template_manager = templately()->theme_builder::$templates_manager;
	}

	public function create( $type, $data, $meta = [] ) {
		$data = wp_parse_args( $data );
		
		$meta = wp_parse_args( $meta, [
			Source::PLATFORM_META_KEY => $this->platform,
			Source::TYPE_META_KEY     => $type,
		] );

		if ( $this->platform === 'elementor' ) {
			$meta[ Document::BUILT_WITH_ELEMENTOR_META_KEY ] = 'builder';
		}

		return $this->template_manager->create( $type, $data, $meta );
	}

}
```
