Block

Class Block


Source

File: src/Conference/Editor/Block.php

class Block {

	/**
	 * Registers the conference schedule block.
	 *
	 * @since 1.0.0
	 */
	public function register_block() {
		register_block_type( 'tec/schedule-block', [
			'editor_script'   => 'event-schedule-manager-schedule-block-js',
			'attributes'      => [
				'date'         => [ 'type' => 'string' ],
				'color_scheme' => [ 'type' => 'string' ],
				'layout'       => [ 'type' => 'string' ],
				'row_height'   => [ 'type' => 'string' ],
				'session_link' => [ 'type' => 'string' ],
				'tracks'       => [ 'type' => 'string' ],
				'align'        => [ 'type' => 'string' ],
			],
			'render_callback' => [ $this, 'schedule_block_output' ],
		] );

		register_block_style( 'tec/schedule-block', [
			'name'         => 'event-schedule-manager-editor',
			'label'        => __( 'Event Schedule Manager Views', 'event-schedule-manager' ),
			'style_handle' => 'event-schedule-manager-editor-css',
			'is_default'   => true,
		] );
	}

	/**
	 * Schedule Block Dynamic content Output.
	 *
	 * @since 1.0.0
	 *
	 * @param array $props An array of attributes from shortcode.
	 *
	 * @return string The HTML output the shortcode.
	 */
	public function schedule_block_output($props) {
		$schedule = new Schedule();
		return $schedule->render_shortcode( $props );
	}
}

Top ↑

Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

Methods