Block::setup_assets()

Setup assets and localizes the data to the block editor script.

Contents


Source

File: src/Events_Pro/Blocks/Calendar/Block.php

	public function setup_assets() {
		$plugin = Tribe__Events__Pro__Main::instance();
		tribe_asset(
			$plugin,
			'tec-events-pro-iframe-content-resizer',
			'node_modules/@iframe-resizer/child/index.umd.js',
			[],
			null,
			[]
		);

		$embed_url = $this->get_embed_url();

		wp_localize_script(
			'tec-calendar-embed-editor-script',
			'tec_events_pro_calendar_embed_data',
			[
				'embed_url'              => $embed_url,
				'embed_nonce'            => wp_create_nonce( 'wp_rest' ),
				'up_sell_img'            => tribe_resource_url( 'images/icons/circle-bolt.svg', false, null, Tribe__Main::instance() ),
				'has_filter_bar'         => has_action( 'tribe_common_loaded', 'tribe_register_filterbar' ),
				'filter_bar_upsell_link' => 'https://evnt.is/1b31',
				'views'                  => array_map(
					static function ( $view ) {
						return tribe( Manager::class )->get_view_label_by_class( $view );
					},
					tribe( Manager::class )->get_publicly_visible_views( false )
				),
			]
		);
	}

Top ↑

Changelog

Changelog
Version Description
7.2.0 Introduced.