<?php
/**
 * Bricks integration bootstrap.
 *
 * @package Ugcify\Bricks
 */

namespace Ugcify\Bricks;

use Ugcify\Bricks\Elements\UGCGalleryElement;

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

/**
 * Class Integration
 */
class Integration {
	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'register_elements' ), 11 );
	}

	/**
	 * Register Bricks elements.
	 *
	 * @return void
	 */
	public function register_elements() {
		if ( ! class_exists( '\Bricks\Elements' ) || ! class_exists( '\Bricks\Element' ) ) {
			return;
		}

		$element_file = UGCIFY_PATH . 'includes/Bricks/Elements/UGCGalleryElement.php';
		if ( ! file_exists( $element_file ) ) {
			return;
		}

		\Bricks\Elements::register_element(
			$element_file,
			'ugcify-gallery',
			UGCGalleryElement::class
		);
	}
}
