Attendee_Registration::get_fields()

Gets the settings.


Return #

(array[]) Key value pair for setting options.


Top ↑

Source #

File: src/Tickets_Plus/Admin/Tabs/Attendee_Registration.php

	public function get_fields(): array {
		$ar_page_description = __( 'Optional: select an existing page to act as your attendee registration page. <strong>Requires</strong> use of the `[tribe_attendee_registration]` shortcode and overrides the above template and URL slug.', 'event-tickets-plus' );

		/** @var \Tribe__Tickets__Attendee_Registration__Main $attendee_registration */
		$attendee_registration = tribe( 'tickets.attendee_registration' );

		$ar_page = $attendee_registration->get_attendee_registration_page();

		// This is hooked too early for has_shortcode() to work properly, so regex to the rescue!
		if ( ! empty( $ar_page ) && ! preg_match( '/\[tribe_attendee_registration\/?\]/', $ar_page->post_content ) ) {
			$ar_page_description = __( '<span class="notice notice-error">Selected page <strong>must</strong> use the `[tribe_attendee_registration]` shortcode. While the shortcode is missing the default redirect will be used.</span>', 'event-tickets-plus' );
		}

		$settings_start = [
			'info-start' => [
				'type' => 'html',
				'html' => '<div class="tribe-settings-form-wrap">',
			]
		];

		$settings_end = [
			'info-end' => [
				'type' => 'html',
				'html' => '</div>',
			]
		];

		$ar_fields = [
			'ar-heading' => [
				'type' => 'html',
				'html' => '<h3>' . __( 'Attendee Registration', 'event-tickets-plus' ) . '</h3>',
			],
			'ticket-attendee-modal'         => [
				'type'            => 'checkbox_bool',
				'label'           => esc_html__( 'Attendee Registration Modal ', 'event-tickets-plus' ),
				'tooltip'         => sprintf(
				// Translators: %1$s: dynamic "tickets" text. %2$s: opening of HTML link. %3$s: closing of HTML link.
					esc_html_x(
						'Enabling the Attendee Registration Modal provides a new sales flow for purchasing %1$s that include Attendee Registration. [%2$sLearn more%3$s]',
						'checkbox to enable Attendee Registration Modal',
						'event-tickets-plus'
					),
					tribe_get_ticket_label_plural_lowercase( 'modal_notice_tooltip' ),
					'<a href="https://evnt.is/attendee-registration" target="_blank" rel="noopener noreferrer">',
					'</a>'
				),
				'size'            => 'medium',
				'default'         => true,
				'validation_type' => 'boolean',
				'attributes'      => [ 'id' => 'ticket-attendee-enable-modal' ],
			],
			'ticket-attendee-info-slug'     => [
				'type'                => 'text',
				'label'               => esc_html__( 'Attendee Registration URL slug', 'event-tickets-plus' ),
				'tooltip'             => esc_html__( 'The slug used for building the URL for the Attendee Registration Info page.', 'event-tickets-plus' ),
				'size'                => 'medium',
				'default'             => $attendee_registration->get_slug(),
				'validation_callback' => 'is_string',
				'validation_type'     => 'slug',
			],
			'ticket-attendee-info-template' => [
				'type'            => 'dropdown',
				'label'           => esc_html__( 'Attendee Registration template', 'event-tickets-plus' ),
				'tooltip'         => esc_html__( 'Choose a page template to control the appearance of your attendee registration page.', 'event-tickets-plus' ),
				'validation_type' => 'options',
				'size'            => 'large',
				'default'         => 'default',
				'options'         => $this->get_template_options(),
			],
			'ticket-attendee-page-id'       => [
				'type'            => 'dropdown',
				'label'           => esc_html__( 'Attendee Registration page', 'event-tickets-plus' ),
				'tooltip'         => $ar_page_description,
				'validation_type' => 'options',
				'size'            => 'large',
				'default'         => 'default',
				'options'         => $this->get_page_options(),
			],
		];

		return array_merge( $settings_start, $this->get_iac_fields(), $ar_fields, $settings_end );
	}

Top ↑

Changelog #

Changelog
Version Description
5.5.1 Introduced.