Tribe_Tickets_Attendees::get_attendees_block( WP_Post|int $post )

Returns the block template’s content.


Parameters

$post

(WP_Post|int) (Required)


Top ↑

Return

(string) HTML.


Top ↑

Source

File: src/Tribe/Shortcode/Tribe_Tickets_Attendees.php

	public function get_attendees_block( $post ) {
		if ( empty( $post ) ) {
			return '';
		}

		if ( is_numeric( $post ) ) {
			$post = get_post( $post );
		}

		// If password protected, then do not display content.
		if ( post_password_required( $post ) ) {
			return '';
		}

		/** @var Tribe__Tickets__Editor__Template $template */
		$template = tribe( 'tickets.editor.template' );

		/** @var Tribe__Tickets__Editor__Blocks__Attendees $attendees_block */
		$attendees_block = tribe( 'tickets.editor.blocks.attendees' );

		$post_id             = $post->ID;
		$title               = $this->get_argument( 'title' );
		$attributes          = [];
		$attributes['title'] = empty( $title ) ? esc_html__( "Who's coming?", 'tribe-ext-tickets-shortcodes' ) : $title;
		$args['post_id']     = $post_id;
		$args['attributes']  = $attendees_block->attributes( $attributes );
		$args['attendees']   = $attendees_block->get_attendees( $post_id );

		// Add the rendering attributes into global context
		$template->add_template_globals( $args );

		// Enqueue assets.
		tribe_asset_enqueue( 'tribe-tickets-gutenberg-block-attendees-style' );

		return $template->template( 'blocks/attendees', $args, false );
	}