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 );
}
}
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |
Methods
- check_for_sessions — Check for sessions in 'tec_session' post type with '_tec_session_time' post meta.
- event_schedule_block_message — Outputs a message for the Event Schedule Block.
- get_icon — Get Icon.
- register_block — Registers the conference schedule block.
- schedule_block_output — Schedule Block Dynamic content Output.