Tribe__Tickets__Editor__Blocks__Rsvp::render( array $attributes = array() )
Since we are dealing with a Dynamic type of Block we need a PHP method to render it
Contents
Parameters
- $attributes
-
(array) (Optional) Block attributes.
Default value: array()
Return
(string)
Source
File: src/Tribe/Editor/Blocks/Rsvp.php
public function render( $attributes = array() ) {
/** @var Tribe__Tickets__Editor__Template $template */
$template = tribe( 'tickets.editor.template' );
$args['post_id'] = $post_id = $template->get( 'post_id', null, false );
$rsvps = $this->get_tickets( $post_id );
$args['attributes'] = $this->attributes( $attributes );
$args['active_rsvps'] = $this->get_active_tickets( $rsvps );
$args['has_active_rsvps'] = ! empty( $args['active_rsvps'] );
$args['has_rsvps'] = ! empty( $rsvps );
$args['all_past'] = $this->get_all_tickets_past( $rsvps );
// Add the rendering attributes into global context
$template->add_template_globals( $args );
// enqueue assets
tribe_asset_enqueue( 'tribe-tickets-gutenberg-rsvp' );
tribe_asset_enqueue( 'tribe-tickets-gutenberg-block-rsvp-style' );
return $template->template( array( 'blocks', $this->slug() ), $args, false );
}
Changelog
| Version | Description |
|---|---|
| 4.9 | Introduced. |