Classic_Editor::render_multiple_links_generator( WP_Post $post, bool $echo = true, null|string $account_id = null, bool $account_loaded = false )

Renders the link generator HTML for 2+ Zoom Meeting types (e.g. Webinars and Meetings).

Currently the available types are, at the most, 2: Meetings and Webinars. This method might need to be updated in the future if that assumption changes. If this method runs, then it means that we should render generation links for both type of meetings.


Parameters

$post

(WP_Post) (Required) The post object of the Event context of the link generation.

$echo

(bool) (Optional) Whether to print the rendered HTML to the page or not.

Default value: true

$account_id

(null|string) (Optional) The account id to use to load the link generators.

Default value: null

$account_loaded

(bool) (Optional) The account is loaded successfully into the API.

Default value: false


Top ↑

Return

(string|false) Either the final content HTML or false if the template could be found.


Top ↑

Source

File: src/Tribe/Meetings/Zoom/Classic_Editor.php

	public function render_multiple_links_generator( \WP_Post $post, $echo = true, $account_id = null, $account_loaded = false ) {
		$hosts = [];
		if ( $account_id ) {
			/** @var \Tribe\Events\Virtual\Meetings\Zoom\Users */
			$users = tribe( Users::class );
			$hosts = $users->get_formatted_hosts_list( $account_id );
		}

		/**
		 * Filters the host list to use to assign to Zoom Meetings and Webinars.
		 *
		 * @since 1.4.0
		 *
		 * @param array<string,mixed>  An array of Zoom Users to use as the host.
		 */
		$hosts = apply_filters( 'tribe_events_virtual_meetings_zoom_hosts', $hosts );

		// Display no hosts found error template.
		if ( empty( $hosts ) ) {
			return $this->render_no_hosts_found();
		}

		$message = '';
		if ( 'not-found' === $account_loaded ) {
			$message = $this->render_account_disabled_details( false, true, false );
		} elseif ( 'disabled' === $account_loaded ) {
			$message = $this->render_account_disabled_details( true, true, false );
		}

		return $this->template->template(
			'virtual-metabox/zoom/setup',
			[
				'event'                   => $post,
				'attrs'                   => [
					'data-account-id' => $account_id,
				],
				'offer_or_label'          => _x(
					'or',
					'The lowercase "or" label used to offer the creation of a Zoom Meetings or Webinars API link.',
					'events-virtual'
				),
				'account_label'            => _x(
					'Account: ',
					'The label used to designate the account of a Zoom Meeting or Webinar.',
					'events-virtual'
				),
				'account_name'            => $this->api->loaded_account_name,
				'generation_toogle_label' => _x(
					'Generate Zoom Link',
					'The label of the toggle to show the links to generate Zoom Meetings or Webinars.',
					'events-virtual'
				),
				'generation_urls'         => $this->get_link_generation_urls( $post, false ),
				'generate_label'        => _x(
					'Create ',
					'The label used to designate the next step in generation of a Zoom Meeting or Webinar.',
					'events-virtual'
				),
				'hosts' => [
					'label'       => _x(
						'Meeting Host',
						'The label of the meeting or webinar host.',
						'events-virtual'
					),
					'id'          => 'tribe-events-virtual-zoom-host',
					'class'       => 'tribe-events-virtual-meetings-zoom__host-dropdown',
					'name'        => 'tribe-events-virtual-zoom-host',
					'selected'    =>  $post->zoom_host_id,
					'attrs'       => [
						'placeholder' => _x(
						    'Select a Host',
						    'The placeholder for the dropdown to select a host.',
						    'events-virtual'
						),
						'data-selected' => $post->zoom_host_id,
						'data-prevent-clear' => true,
						'data-hide-search' => true,
						'data-options' => json_encode( $hosts ),
					],
				],
				'remove_link_url'       => $this->get_remove_link( $post ),
				'remove_link_label'     => $this->get_remove_link_label(),
				'message'               => $message,
			],
			$echo
		);
	}

Top ↑

Changelog

Changelog
Version Description
1.5.0 - Add support for multiple accounts.
1.4.0 - Add support to choose a host before meeting or webinar creation.
1.1.1 Introduced.