HEX
Server: Apache
System: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User: u106391720 (10342218)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /homepages/34/d890102484/htdocs/sites/tesoftV2/wp-content/plugins/hyve-lite/inc/Block.php
<?php
/**
 * Block class.
 * 
 * @package Codeinwp/HyveLite
 */

namespace ThemeIsle\HyveLite;

/**
 * Block class.
 */
class Block {
	/**
	 * Constructor.
	 */
	public function __construct() {
		add_action( 'init', [ $this, 'register_block' ] );
		add_shortcode( 'hyve', [ $this, 'render_shortcode' ] );
	}

	/**
	 * Register block.
	 * 
	 * @return void
	 */
	public function register_block() {
		register_block_type( HYVE_LITE_PATH . '/build/block' );
	}

	/**
	 * Render shortcode.
	 * 
	 * @param array $atts Shortcode attributes.
	 * 
	 * @return string
	 */
	public function render_shortcode( $atts ) {
		if ( isset( $atts['floating'] ) && 'true' === $atts['floating'] ) {
			return do_blocks( '<!-- wp:hyve/chat {"variant":"floating"} /-->' );
		}

		return do_blocks( '<!-- wp:hyve/chat /-->' );
	}
}